• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

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.
0
sandya_116
Asked:
sandya_116
  • 4
  • 3
1 Solution
 
Fernando SotoCommented:
Hi sandya_116;

Try using the Process class to start the program and see if that works for you.

Process.Start("C:\Program Files\Integra\DestinyLOS\DestinyLOS.exe", "-s RestartPS")

Fernando
0
 
sandya_116Author Commented:
I tried the process.start in a regular vb.net program and it worked. But again it did not work in the windows service.
0
 
Fernando SotoCommented:
Does it throw an error?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sandya_116Author Commented:
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.
0
 
Fernando SotoCommented:
I am sorry I have not worked with services before I was hoping that this would have worked.

Good luck;
Fernando
0
 
sandya_116Author Commented:
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)
0
 
Fernando SotoCommented:
Well that is just great. Glad to hear you got it going.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now