Re bapala:
As the several posters above said, a ' wrapped in quotation marks will not be treated as a comment.
Also, if you run into characters that seem hard to handle, you can try using the chr function instead. For example:
strCmd = Chr(39) & "notepad.exe" & chr(39)
As for terminating a process, there is no rule saying you must add single quotes on both sides of the process name. I think you're probably using the select xxx from win32_process where .... statement in the execquery method. I suggest you change it to one of the following:
:
strProcess = "notepad.exe"
for each x in getobject("winmgmts:win32_process").instances_
if ucase(x.name) = ucase(strProcess) then x.Terminate
next
:
strProcess = "notepad.exe"
for each x in getobject("winmgmts:").instancesof("win32_process")
if ucase(x.name) = ucase(strProcess) then x.Terminate
next
Or you can use the wscript.arguments object to obtain the name of the process to be terminated through parameters.
None of the above code has been tested; if there are errors, please debug and modify it yourself.