How to enable "'installutil' is not recognized as an internal or external command, operating program, or batch file."?

Just tried to run the application through:

enter image description here

I looked at the directory with the WindowsService1.exe application in it, and then tried the Installutil WindowsService1.exe command, but received the following error ...

enter image description here

Since VS was only installed for a day or two, I am worried that something might be wrong with this installation, since it should recognize installutil.

Is there some basic diagnostics I can do to ensure that VS Command Prompt finds all the programs that it should have run?

EDIT

If I run PATH on the command line, I see the following:

enter image description here

+49
c # cmd visual-studio visual-studio-2012
03 Oct '12 at 7:20
source share
11 answers

This is a tiny bit off topic, but I stopped using InstallUtil to install my services. It is very simple to add it to the service itself. Add a link to System.Configuration.Install (not available in client profile releases, if I remember correctly), and then update the Main () function in Program.cs as follows.

 static void Main(string[] args) { if (Environment.UserInteractive) { string parameter = string.Concat(args); switch (parameter) { case "--install": ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location }); break; case "--uninstall": ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location }); break; } } else { ServiceBase[] servicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(servicesToRun); } } 

Then you can just call WindowsService1.exe with the argument --install , and it will install the service, and you can forget about InstallUtil.exe .

+115
03 Oct '12 at 7:35
source share

Here is what I did to make him leave:

  • Find where installutil is on my pc. In my case, it was C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319

  • Opened a command prompt as administrator and changed the current directory to above: 'cd C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319'

  • Then type: 'installutil C: \ MyProgramName.exe'

Interestingly, before the solution above, I tried various options, including adding C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 to the System Path variable, but it still could not find it.

We wish you a complete smooth installation.

+30
Dec 10 '13 at 7:15
source share

InstallUtil.exe is usually located in one of the versions listed in the C: \ Windows \ Microsoft.NET \ Framework section.

In my case, it is under v4.0.30319.

You can just check your path:

echo% PATH%

should provide you with a list of directories that searched for executables.

+27
03 Oct '12 at 7:25
source share

Found solution on bytes.com

Code to install the service:

 @ECHO Installing Service... @SET PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319\ @InstallUtil C:\Unlock_4_Service\bin\Debug\Unlock_4_Service.exe @ECHO Install Done. @pause 

@InstallUtil <.exe file path of your Windows service>

Service Removal Code

 @ECHO Installing Service... @SET PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319\ @InstallUtil /u C:\Unlock_4_Service\bin\Debug\Unlock_4_Service.exe @ECHO Uninstall Done. @pause 

@ InstallUtil / u <.exe file path of your Windows service>

Save 2 files as service_install.bat and service_uninstall.bat

Run files as administrators every time you need to install or uninstall a service. enter image description here

+4
Jun 16 '15 at 4:29
source share

Before installing a service using the command line ...

use 2 steps:

  1. cd C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319
  2. InstallUtil.exe Path \ MyWindowsService.exe
+3
Feb 19 '19 at 9:46
source share

If you have not changed your path, the following should not be indicated on the developer's command line:

  • Msbuild
  • mstest (for the ultimate)
  • csc
  • ILASM

... etc.

If they are not available, you may have a damaged installation.

+2
03 Oct '12 at 7:24
source share

Perhaps this happened because you did not open Command Prompt as administrator or administrative privileges.

+2
May 7 '14 at 9:33
source share

open the Visual Studio command line in administrator mode, that is, right-click on the vs command line and run as administrator

+2
Nov 30 '16 at 9:54 on
source share

According to Microsoft Page :

If you are using the Visual Studio command line, InstallUtil.exe should be in the system path. If not, you can add it to the path or use the full path to call it. This tool is installed with the .NET Framework, and its path:

% WINDIR% \ Microsoft.NET \ Framework [64] \

For example, for the 32-bit version of the .NET Framework 4 or 4.5. * If the Windows installation directory is C: \ Windows, the path is:

C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ InstallUtil.exe

For the 64-bit version of the .NET Framework 4 or 4.5. * Default path:

C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ InstallUtil.exe

+2
Oct 29 '18 at 13:15
source share

I got this after returning to 2015 from 2017, and I was still using the 2017 command line. Check something.

+1
May 25 '17 at 19:21
source share
 Add this in windows Environmental variables First: Right click on My computer or This PC Second: Click on Environmental Variables Third: add this path after clicking on path C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe 
+1
Jan 29 '19 at 9:24
source share



All Articles