Windows Scripting

Soldato
Joined
12 Dec 2003
Posts
2,588
I want to write a script that when I run it, it toggles a Service on/off
ie so run it first time, it turns the service on, run it a second time it turns the service off. How would I go about this?
(I know I could just make 2 seperate script files but I wanted to know if its possible to combine them).

Thanks
 
Well for that I'd need 2 seperate files wouldnt I?
I was thinking something like:

If ServiceName = Started
Then net stop ServiceName
If ServiceName = Stopped
Then net start ServiceName
 
Oh, right. I have VB 2008 Express Installed but I dont know what sort of project to create. I tried 'Console App', then pasted the code in but it didnt have 'Make Project1.exe' in the File menu.
 
There was a toggle.vshost.exe in ToggleProject\bin\Debug but double clicking it didnt seem to do much... would it be easier if you just compiled the exe and sent it to me? If so the service I am trying to start/stop is called 'KService', thanks for all the help!
 
Back
Top Bottom