Question: 3
I'm trying to install a Windows Service using a batch file, let's call it "setup.bat". Inside the file I have the following commands:

```
"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil" "MyService.exe"

```

When I excute the batch file (running as administrator on windows7) I get this:

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Win
dows\system32\MyService.exe' or one of its dependencies. The system cannot f
ind the file specified.. 
The actual service is located at 
`"SomeRandomLocation\MyService.exe".`
the bat file is 
`"SomeRandomLocation\setup.bat"`

what is going on? how do I force it to install from my "setup.bat" folder?

**this should work dynamicly. meaning in any folder!**

Answer: 
If you create a .bat file, then the working directory is based on the location from where you invoked the .bat. If you created a shortcut to the .bat file, then the working directory is based on the location of the .bat file. Any relative path in your script is interpreted relative to the working directory.

To avoid changing all your paths. Just issue a `cd C:\Services` at the beginning of your bat file.
although this is an old question...

what helped me to solve the issue is to run the installer with logs

For example:

```
"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil" "MyService.exe" /LogToConsole /ShowCallStack

```

In my case the original error was like yours 

> 
> FileNotFoundException
> 
> 
> 

, but in the logs I found 

> 
> SecurityException
> 
> 
> 

The solution was to run as administrator