![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3
![]() |
There has got to be a better way.....
Ok, presently this is the method I use for running an external *.exe from within a vbscript.
strComputer = "."
Hidden_Window=5
Set objWMIService = GetObject ("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = Hidden_Window
Set objProcess = GetObject ("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("D:\ISRA\COSS\Filewatch.exe", null, objConfig, intProcessID)Is there a better way to run an external *.exe from within a VBScript? I need to run it, then kill it. I search for a bit but couldn't find anything useable. Thanks in advanced.
__________________
_Marshall_ "America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt." |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 253
Rep Power: 4
![]() |
Hi, give this a try.
vbnet Syntax (Toggle Plain Text)
check out this page for additonal parameters you can use with the run method. http://www.devguru.com/Technologies/...shell_Run.html
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt Last edited by melbolt; Aug 2nd, 2006 at 7:13 PM. |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 253
Rep Power: 4
![]() |
oh, and you wanted to kill the process too.
vbnet Syntax (Toggle Plain Text)
basically it queries running processes for the desired one and terminates it. note: I'm not sure if this is being performed on the local machine or on a remote machine, the code above is for local, if you want to kill on remote machine, check the link below. all this code was stolen from here, i take no credit but i did test them personally and they work http://www.computerperformance.co.uk...ocess_stop.htm
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|