
CODE: [Copy to clipboard]@echo off
set "strcmd='notepad.exe'"
echo %strcmd%
pause
| Quote: | |
|
| Quote: | |
|
CODE: [Copy to clipboard]至于结束进程,并没有什么规定必须要在进程名两边加单引号,我想你应该是用的execquery方法中的select xxx from win32_process where ....语句吧。建议你换成如下语句:strCmd = Chr(39) & "notepad.exe" & chr(39)
CODE: [Copy to clipboard][2]:strProcess = "notepad.exe"
for each x in getobject("winmgmts:win32_process").instances_
if ucase(x.name) = ucase(strProcess) then x.Terminate
next
CODE: [Copy to clipboard]又或者你可以用wscript.arguments对象通过参数来获得被结束的进程名。strProcess = "notepad.exe"
for each x in getobject("winmgmts:").instancesof("win32_process")
if ucase(x.name) = ucase(strProcess) then x.Terminate
next
| Quote: | |
|
| Quote: | |
|
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |