[英]Taskkill Exit code : 255
I'm trying to distribute software through SCCM 2012; 我正在尝试通过SCCM 2012分发软件; running a simple command in a vbs, ends with the result code 255.
在vbs中运行简单命令,结果代码为255。
Example: 例:
WshShell.run ("TASKKILL /F /IM """ & processname & """ /T", 0, True)
After returning 255, the script stops and doesn't install the software. 返回255后,脚本将停止并且不安装软件。
Someone had this problem? 有人有这个问题吗? What does the code 255 mean?
代码255是什么意思?
Thanks. 谢谢。
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process")
For Each objItem in colItems
'msgbox objItem.ProcessID & " " & objItem.CommandLine
If objItem.name = "Calculator.exe" then objItem.terminate
Next
Is how to terminate programs in vbscript. 是如何终止vbscript中的程序。
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
. 首先,在调用Sub时不要使用
parentheses
在将该行分配给Variable或使用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. 其次,我更喜欢使用
False
而不是True
来避免在脚本中中继,直到执行完命令行为止,而不是我喜欢使用wscript.sleep 300
如果您将在此行代码之后执行另一行。请不要中继自动东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.