0

I have an executable EMC_WS.EXE and I want to run this using the command

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

The executable runs correctly, but the command window is not appearing. I have used mingwstudio to generate 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)
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328

0 Answers0