WScript.Shell没有打开命令窗口

时间:2018-04-10 12:06:02

标签: vbscript

我有一个可执行文件EMC_WS.EXE,我想使用命令

运行它
WshShell.Run "EMC_WS.EXE", 1, False

可执行文件正确运行,但命令窗口没有出现。我使用mingwstudio生成EMC_WS.EXE

Dim pathString, UserPath
Dim position
Dim WshShell, Shell

Set WshShell = WScript.CreateObject("WScript.Shell")
Set Shell = WshShell.Environment("User")

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'EMC_WS.EXE'")

For Each objProcess In colProcessList
    objProcess.Terminate()
Next

WshShell.Run "EMC_WS.EXE", 1, False

Set WshShell = Nothing
WScript.Quit(0)

0 个答案:

没有答案