this is the correct way
processname="my process name .exe"
WshShell.run "TASKKILL /F /IM """ & processname & """ /T", 0, False
wscript.sleep 300
First don't use parentheses
when you calling a Sub .Use parentheses when you assign that line
to Variable or when you use word call
.
var = WshShell.run ("TASKKILL /F /IM """ & processname & """ /T", 0, False)
Or
Call WshShell.run ("TASKKILL /F /IM """ & processname & """ /T", 0, False)
Second i prefer to use False
instead of True
to avoid relay in the script to wait until
finish execute the command line instead of that i like use wscript.sleep 300
if you will execute other line after this line of code .don't relay automatic stuff.