How to Install Windows Service using command prompt


  • Hello all,

    I want to install the windows service using DOS Prompt(not Visual Studio command prompt).

    How to do this?

    plz help me will be appriciated

    Monday, May 15, 2006 12:08 PM


  • Hi

    Sorry for the confusion, you still need to invoke installutil in order to install your service, there's no other way to do this if you dont have the .Net Framework runnig on your machine. The alturnatives if you are using normal CMD are :-

    1. On VS 2003 :- C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe C:\MyService.exe

    2 On VS 2005 Express :- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe C:\MyService.exe

    Hope this Helps

    Monday, May 15, 2006 1:30 PM

All replies

  • hi

    In VStudio command prompt run :- installutil <Path of the Service> (e.g installutil C:\MyService.exe)

    Im not sure if normal DOS cmd can do this.

    Hope this helps.

    • Proposed as answer by bennett.d Wednesday, April 03, 2013 5:02 PM
    Monday, May 15, 2006 12:19 PM
  • plz read once again my question.

    I want to install windowsService from command Prompt.

    Not from VisualStudioCommandPrompt.


    How to do this?



    Monday, May 15, 2006 12:39 PM
  • Hi

    Sorry for the confusion, you still need to invoke installutil in order to install your service, there's no other way to do this if you dont have the .Net Framework runnig on your machine. The alturnatives if you are using normal CMD are :-

    1. On VS 2003 :- C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe C:\MyService.exe

    2 On VS 2005 Express :- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe C:\MyService.exe

    Hope this Helps

    Monday, May 15, 2006 1:30 PM



    I have tried the above steps, but the problem is that I am having Windows XP and it doesnot recognize InstallUtil via command prompt. Is there any alternative command which I can use instead of InstallUtil.


    Thanks & Regards,

    Amit H

    Monday, March 17, 2008 7:26 AM
  • Hi Amit

    You need to have atleast the .Net Framework installed ( i guess your service is .net and hence would need it anycase rt)
    After that go to your .Net framework folder under windows directory and run the installUtil application to register the service.

    Thanks n Regards
    Anu Viswan
    Monday, March 17, 2008 9:03 AM
  • Hi All,

    Check if .NET framework 2.0 is installed. u can find the folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder. Just use the installutil.exe utility from this folder and install the service.

    Tuesday, June 03, 2008 9:10 AM
  • Hello Ramana,

    I can understand your problem..
    InstallUtil is a Visual Studio command and so it wont recognise in the command prompt in Windows XP since a path to it has not been set..
    So you have to set a path for this command so that windows may recognise it...

    Try these steps:
    1. Right Click 'My Computer' in your desktop.
    2. goto Properties -> Advanced -> Environment Variables
    3. Find the 'Path' variable in system variables and click EDIT.
    4. Add this path C:\Program Files\Microsoft Visual Studio 9.0\VC\; to you existing path.
    5. Restart cmd and type installutil at command prompt. If it works correctly, some text would scroll up in the command window.

    Remember you need to append this path to the existing path variable. This means that if a semicolon is not there at the end of the existing path, dont forget to first type a semi colon ';' and then add the path in step 4.

    If .NET is installed in some other drive, give the appropriate path..

    Hope this helps !!
    Always mark the post that helped you as "Answer". That helps future users to locate answers quickly.
    • Proposed as answer by Somnath Paul Tuesday, June 03, 2008 9:22 AM
    Tuesday, June 03, 2008 9:22 AM
  • thank you for giving the path, this helpe me very much
    Thursday, August 14, 2008 9:56 AM
  • Hi friend,

    I have implemented as you said and it works for me very nice.

    But friend i want to install windows service for .net framework 3.5 so from where i can run?

    I have windows service exe making in .net 3.5. now i want to install this so how can it possible?

    Thanks & Regards
    Wednesday, July 29, 2009 9:06 AM
  • Hi All,

    I had used all the above methods to install a windows service using installutil.exe. I tried both in Visual Studio command prompt as well as Windows cmd (by the appropriate ways specifies above).
    In VS Command Prompt i am using the command : C:\folder pathname-----\installutil.exe bin\MyService.exe
    But, i am continuously getting the same error all the time : Exception occurred while initializing the installation:System.IO.FileNotFoundException:Could not load file or assembly "path of the file----/installutil.exe bin\MyService.exe" or one of its dependencies. The system could not find the file specified..

    Though i could see that the MyService.exe file is well created in the bin/Debug folder in my solution folder.

    I dont know what is going wrong here...Can anybody please help?

    Thanks and regards,

    Wednesday, July 29, 2009 3:52 PM
  • If in the VS command prompt, I type down : "C:\ ---pathname---\ installutil.exe Myservice.exe " , It tries to install the service but fails everytime. It says "The installation failed, and the Rollback has been performed." I dont know how to proceed with needed..!
    Wednesday, July 29, 2009 4:02 PM
  • you need to go to the corresponding folder for the version of .net in "C:\WINDOWS\Microsoft.Net\Framework\" in command prompt

    I believe for .net 3.5 you need to use "AddInUtil.exe"

    And then run that followed by C:\--Path-to-serverice.exe--\service.exe and that should work....
    Thursday, August 06, 2009 3:29 PM
  • Hello Ramana!

    Please check this way (

    Best wishes,

    Scio me nihil scire
    Thursday, August 06, 2009 4:59 PM
  • Hi Abhinav,

    I hope you have the .Net Framework 2.0 installed on your machine.
    When you are running installUtil.exe from the VS Command prompt please use the full path for your  exe file that you have craeted eg.

    c:\Program Files\Microsoft Visual Studio 9.0\VC>InstallUtil  c:\Application Folder\Bin\Release\FileName.exe

    This should work.
    FYI :
     Use installUtil /u  to unistall the service


    Tuesday, August 18, 2009 8:19 PM
  • Simple. Once upon a time, before .NET this was done manually. Luckilly, Windows still supports this process.

    Open a command prompt and execute    SC /?.

    This is the command line application for managing the NT Service Controller.
    Gary in Massena
    • Proposed as answer by GTNovosel Friday, October 09, 2009 2:20 PM
    Friday, October 09, 2009 2:19 PM
  • There is no difference b/w the VisualStudioCommandPrompt and cmd except the evironment variables and the default working directory.
    Vibhor Agarwal
    Sunday, April 18, 2010 5:01 PM
  • Abhi......Need to provide the full path.


    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>installutil C:\YourProject\bin\YourExeFile.exe

    Friday, June 18, 2010 7:53 PM
  • Explanation cannot be any more simpler than suggested by BullDog.

    Friday, June 18, 2010 7:55 PM
  • you can find installutil.exe only in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727.

    I am unable to find that in other versions. Any way your post is helpful man...thanks.

    Wednesday, July 28, 2010 12:14 AM
  • Hi Ramana


    I don't know why guys are complicating life for you... just go to command prompt and use servicename.exe /install


    C:\Documents and Settings\igachugu>e:

    E:\>cd timer

    E:\Timer>Cyberman.exe /install  (This installs the windows service Cyberman.exe and gives a confirmation)

    E:\Timer>Cyberman.exe /uninstall (This removes the service)



    Let me know if it works.


    Saturday, August 21, 2010 12:06 PM
  • To install windows service using Command Prompt, you should set the Variable Environment to the path where installutil saved, so the command prompt  so the command prompt will recognized the 'Installutil'.

    How to set the windows Variable environment you can refer to this link

    Regards, Christofel
    Friday, January 28, 2011 1:12 AM
  • Below link provide a clean and crisp solution for the above problem
    Sunday, February 27, 2011 7:13 AM
  • Wednesday, April 13, 2011 11:04 AM
  • Apologies, though it is silly, if you can't find it why don't you search for it? :) No offence mate.
    Thursday, October 06, 2011 8:42 AM
  • I think it would be:

    C:\folder pathname----bin\debug>installutil MyService.exe 

    hope it will help you.

    Wednesday, August 29, 2012 7:22 AM
  • Run your ComandPrompt as "Run As Administrator" and follow these steps

    CMD---> Run as Administrator
    --->set cmd path to installutil.exe (eg:C:\Windows\Microsoft.NET\Framework\v2.0.50727)
    ---> type InstallUtil.exe ----"path of your service"--- 

    complete path looks as(WindowsServicesTimer.exe is the name of the service)

    eg(C:\Windows\Microsoft.NET\Framework\v2.0.50727>InstallUtil.exe D:\vasant\WndowSer



    Friday, October 05, 2012 6:47 AM
  • "servicename.exe /install" Doesn't work.  Windows pops up a dialog telling you to use installutil.exe

    • Edited by zhiwong Friday, October 12, 2012 8:29 PM
    Friday, October 12, 2012 8:28 PM
  • Is this your service or one you have from somewhere else?  I always build a custom Installer class into my services so that you can install them via the command line (-i to install, -u to uninstall).  You basically need to create your own class derived from Installer and add a properly initialized ServiceProcessInstaller and a ServiceInstaller to the list of Installers.
    Saturday, October 13, 2012 3:19 AM
  • C:\Users\Administrator>c:\Windows\Microsoft.NET\\Framework\v4.0.30319\installuti
    l slpusher.exe
    Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Exception occurred while initializing the installation:
    System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Use
    rs\Administrator\slpusher.exe' or one of its dependencies. The system cannot fin
    d the file specified..

    I got this error and I dont have any ideas about how to solve it..anyone can help me?

    Wednesday, October 24, 2012 10:42 PM
  • You need to run it in the same folder as "where you placed your EXE files".
    Thursday, October 25, 2012 3:50 AM
  • You need to code the EXE so that it supports that kind of installation.

    There aren't free lunch there...

    Thursday, October 25, 2012 3:51 AM
  • From Command Prompt:

    sc create "Service Name" binpath= "FULL PATH TO EXECUTABLE" start= auto

    Please note!!!

    The spaces after the equal signs are required most of the time. Include them.

    • Proposed as answer by ZackinMA Monday, November 11, 2013 8:57 PM
    Sunday, December 09, 2012 5:39 PM
  • This is for future reference.

    Please follow steps in following link to build .exe file. Then follow further steps to install the windows service

    After building .exe file for the Windows Service, the .exe file resides inside the Debug folder of the service. (eg - C:\ProjectName\ProjectNameService\bin\Debug).

    Start>>search for Command prompt in the search bar. Right click on "Visual Studio Command Prompt (2010)", select "Run As Administrator".  NOTE: Please make sure that you have selected a Visual Studio Command Prompt and not the general DOS prompt. It is because the "installutil" command that we will be using next will not run in the general DOS prompt. It will display an error message.

    cd\ to go to C:\>

    C:\>cd C:\ProjectName\ProjectNameService\bin\Debug

    C:\ProjectName\ProjectNameService\bin\Debug>installutil Service.exe

    This will install the windows service.

    Wednesday, December 12, 2012 6:25 PM
  • middle of the article

    install windows service

    Thursday, November 07, 2013 6:46 PM
  • More than 3 years after, this comment was very helpful to me. Thanks Gachugu!
    • Edited by LizzNando Monday, January 20, 2014 10:07 PM
    Monday, January 20, 2014 10:06 PM