Nov 14 2006

Service Path To Executable

Published by gringod at 5:30 pm under General

Today I’ve been editing and testing a Windows Service application.  I’ve got my system setup so that whilst running in debug mode the application runs as a command line application, so that the debugger automatically connects to it rather than me having to manually connect the debugger to the service every time I want to test my code.

When I switch to Rlease mode the application gets compiled as a service and is automatically started using a post-build action.  This is where I ran into a problem.  Its been a while since I last ran the service on my machine and the release exe location has changed since then and the service starter complained about to path to exe being incorrect.  I could have re-installed the service but I thought it would be easier (and better) to change the location of the currently installed exe.

This is a lot easier than it sounds and can be accomplished with the good ole regedit.  Just click on Start Menu -> Run and enter “Regedit” (sans quotes).  Then you need to navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[Name of Service].  To change the location of the exe just change the ImagePath key.

Please note that directly editing the registry with Regedit can completely balls up your machine and prevent it from starting.  If in doubt seek professional help, so you can blame someone else if it all goes tits-up.

16 responses so far

16 Responses to “Service Path To Executable”

  1. Owenon 22 Apr 2008 at 12:31 am

    Thanks for this tip!

  2. Joon 05 Jun 2008 at 10:53 am

    I used your advise to change the path for BackupExec services which did not update after an upgrade. It worked perfectly. Thank you!

  3. David Ninoon 30 Jul 2008 at 9:06 am

    Thanx a lot.
    It worked perfectly.

    thanx again

  4. Scotton 18 Aug 2008 at 8:51 pm

    A simple solution to a seemingly unsolvable problem. Thanks!

  5. Johnnyon 22 Aug 2008 at 3:30 pm

    Really great tip! Thanks for the help! :-)

  6. Alireza Kashianon 28 Aug 2008 at 7:34 pm

    Thanks for this great Hint. This was exactly what I was searching for. I could edit the Path.

  7. Nateon 13 Sep 2008 at 4:31 am

    Thank you, it helps me !

  8. elijahon 21 Apr 2009 at 1:10 pm

    Thanx a bunch for this tip, helped me out with Oracle DB services, which, to be honest, are a mess. Especially when you reinstall the database instance, whoever tried this once knows what I’m taking about here :)

  9. Virafon 17 May 2009 at 2:17 pm

    thanks, worked really well

  10. Mitjaon 13 Oct 2009 at 12:58 pm

    Great help; thanks

  11. Gregon 15 Oct 2009 at 3:39 pm

    It helped, thanks!

  12. evasonon 15 Dec 2009 at 1:42 pm

    let me thanx for you are big help.

  13. Birdog9999on 28 Feb 2010 at 4:09 pm

    I was having a problem installing a printer each time it would say print spooler not running. When I tried to start the spooler it would say can’t find the path. I was able to set the path which was blank using your method and it worked perfectly. Thanks what a great help!

  14. Kyleon 24 Jun 2010 at 4:39 pm

    Worked for me too, thanks. Used it for changing the service path for MS SQL Server Analysis Services that someone had set to include a -s config switch … which didn’t work so well when we tried to get rid of that volume.

  15. [...] http://www.gringod.com/2006/11/14/service-path-to-executable/ [...]

  16. Whittleyon 06 Sep 2010 at 4:24 pm

    Thanks man for your help.

Trackback URI | Comments RSS |

Leave a Reply