• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • 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 SotoRetiredCommented:
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 SotoRetiredCommented:
Does it throw an error?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 SotoRetiredCommented:
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 SotoRetiredCommented:
Well that is just great. Glad to hear you got it going.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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