• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Question VBS Scripting - Help Needed

BadThad

Lifer
I need a VBS script to kill two running processes. I can do it in PowerShell, no problems using:

taskkill /f /im CorsTra.exe
taskkill /f /im M95Hid.exe

However, in my google searches (yes, I'm pathetic with code) none of the suggestions worked and I tried a few like this:

Dim oShell : Set oShell = CreateObject("WScript.Shell")​

oShell.Run "taskkill /f /im M95Hid.exe",,True​

Dim oShell : Set oShell = CreateObject("WScript.Shell")​

oShell.Run "taskkill /f /im CorsTra.exe",,True​


What VBS code do I need to accomplish this simple task because the above and nothing else I tried does? They run but the processes never end. Thanks!
 
Why not just remove them from startup?


 
Why not just remove them from startup?


Because I want them to run at start-up and my PC very rarely gets rebooted. There are reasons I need to do this, I've been a computer enthusiast for 25+ years.
 


or


or

 
Last edited:
Why not just create a powershell script?
That is exactly what I'm trying to do. However, it does not stop the processes - I just want help with the syntax I posted above. As stated, I can open powershell and the commands execute successfully with no problems (the processes stop). However, when I write the code, save it as a .vbs file and run it - it does not stop the processes.

Thanks
 
That is exactly what I'm trying to do. However, it does not stop the processes - I just want help with the syntax I posted above. As stated, I can open powershell and the commands execute successfully with no problems (the processes stop). However, when I write the code, save it as a .vbs file and run it - it does not stop the processes.

Thanks
Sorry, I misunderstood. You want code that'll do what PowerShell does easily, except as a VB script. Good luck, haven't written any VBS in long time.
 
Sorry, I misunderstood. You want code that'll do what PowerShell does easily, except as a VB script. Good luck, haven't written any VBS in long time.
Exactly, thanks for clearing it up. It's a simple thing really, a lot of people know VB....but they're not here anymore I guess. 🙁
 
What errors are you getting?

When I copy & paste your code into notepad++, it kept complaining invalid characters

When I turned on showing all hidden characters, it showed that ZWSP (zero width space) character was appended at the end of line. I have to remove that ZWSP from the file so it can compile.

The following code worked without error.
Code:
Dim oShell
Set oShell = Wscript.CreateObject("WScript.Shell")
oShell.Run "taskkill /f /im notepad.exe"
Set oShell = Nothing

Also haven't done programming for a long time, by the way.

Can't install Corsair M95 software since I don't have that mouse.
 
That is exactly what I'm trying to do. However, it does not stop the processes - I just want help with the syntax I posted above. As stated, I can open powershell and the commands execute successfully with no problems (the processes stop). However, when I write the code, save it as a .vbs file and run it - it does not stop the processes.

Thanks
You do not need to run this as VBS, save it as a text file rename the extension to .bat and run it as administrator, or just run the vbs as admin, I'm pretty sure the only issue here is the admin/elevated access.
You can only run powershell as admin so it would work inside of that, outside you have to force admin.

I'm talking about these commands.
taskkill /f /im CorsTra.exe
taskkill /f /im M95Hid.exe
 
You do not need to run this as VBS, save it as a text file rename the extension to .bat and run it as administrator, or just run the vbs as admin, I'm pretty sure the only issue here is the admin/elevated access.
You can only run powershell as admin so it would work inside of that, outside you have to force admin.

I'm talking about these commands.
taskkill /f /im CorsTra.exe
taskkill /f /im M95Hid.exe
YES - that worked! Hallelujah, you are THE MAN, thanks!
 
Back
Top