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\D estinyLOS. 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.
Dim commandline As String = "C:\Program Files\Integra\DestinyLOS\D
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does it throw an error?
ASKER
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
Good luck;
Fernando
ASKER
Its ok. I got it working now. I used the following code:
Dim oStartInfo As New ProcessStartInfo()
oStartInfo.UseShellExecute = True
oStartInfo.WorkingDirector y = "C:\Program Files\Integra\DestinyLOS"
oStartInfo.FileName = "DestinyLOS.exe"
oStartInfo.Arguments = "-s RestartPS"
Process.Start(oStartInfo)
Dim oStartInfo As New ProcessStartInfo()
oStartInfo.UseShellExecute
oStartInfo.WorkingDirector
oStartInfo.FileName = "DestinyLOS.exe"
oStartInfo.Arguments = "-s RestartPS"
Process.Start(oStartInfo)
Well that is just great. Glad to hear you got it going.
ASKER