Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i want to change the path to executable for a service from command.

how can i do that?

i want to run another exe from that service's path to executable.

share|improve this question
    
If Dave's answer is not what you need, then please use the "edit" link to explain a bit more? –  Arjan Dec 15 '10 at 23:13

2 Answers 2

You will need to do that in the registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Navigate to the service, then modify the image name to reflect the new path

As always, make a backup of the system PRIOR.

share|improve this answer

You can use the sc config command to change the path a service points to:

SC CONFIG YourServiceName binPath= "C:\SomeDirectory\YourFile.EXE"

This will update the service called YourServiceName and change the "Path to Executable" entry to C:\SomeDirectory\YourFile.EXE. You will want to restart your service afterwards, which you can do with:

NET STOP YourServiceName & NET START YourServiceName
share|improve this answer
2  
+1 for clearly answering the question and for showing me a command I didn't know –  Corin Aug 4 '11 at 20:35
    
If you are moving MySQL config (.ini) to another drive. You can leave out the inner quotes. Just wrap the entire modified string in a single pair of double quotes. Moved my .ini and data folder to D: drive on Win7. –  Brian Boatright Nov 18 '11 at 2:10
    
What about when the Path to executable also contains quotes and other parameters? For example: "C:\Program Files\CollabNet\Subversion Server\svnserve.exe" --service -r "E:\Repositories" --listen-port "3690" I sadly had to go the regedit route for this one. –  James Skemp Dec 6 '11 at 22:14
    
@James - I'm pretty sure you can escape those characters, but I'll have to play around with it and get back to you. –  LittleBobbyTables Dec 8 '11 at 3:41
1  
Would like to note there is a required space between binpath= and the command. Dumb, I know. –  Chloe Sep 7 '12 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.