Link to home
Start Free TrialLog in
Avatar of sandya_116
sandya_116

asked on

windows service shell command

I have the following code in a windows service:

Dim commandline As String = "C:\Program Files\Integra\DestinyLOS\DestinyLOS.exe -s RestartPS"
Shell(commandline)
The above shell command works in a regular vb.net program, but doesn't work in windows service. IS there something that I need to do for it to work in windows service. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sandya_116
sandya_116

ASKER

I tried the process.start in a regular vb.net program and it worked. But again it did not work in the windows service.
Does it throw an error?
IT did not throw any error. When I clicked on the properties for the windows service and chose the option "allow service to interact with desktop" on log on tab, it popped up a message saying file not found. But the file is there. The same command works on regular programs.
I am sorry I have not worked with services before I was hoping that this would have worked.

Good luck;
Fernando
Its ok. I got it working now. I used the following code:
Dim oStartInfo As New ProcessStartInfo()
oStartInfo.UseShellExecute = True
oStartInfo.WorkingDirectory = "C:\Program Files\Integra\DestinyLOS"
oStartInfo.FileName = "DestinyLOS.exe"
oStartInfo.Arguments = "-s RestartPS"
Process.Start(oStartInfo)
Well that is just great. Glad to hear you got it going.