The code for the service is as follows
System.Diagnostics.Process proc = new System.Diagnostics.Process(); // Declare New Process
var arguments =
String.Format("--ip {0} --user {1} --passwd {2} --guest {3} --gpasswd {4} --action {5}",
controllerIPAddress, controllerUsername, controllerPassword, username, password, action);
proc.StartInfo.Arguments = arguments;
proc.StartInfo.FileName = "C:\\Program Files\\Netspot\\ControllerInterfaceService\\batchfile.bat";
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
I have a windows service that runs a dos script that calls a WGET command, all good, but I need to create and delete a temp folder using the batch script.
The problem I have is that the service is mapping the path to
c:\windows\system32
instead of
C:\\Program Files\\Netspot\\ControllerInterfaceService\\
This works fine within a test harness.
Any ideas on why the service uses the system32 folder instead of mapping to the local folder
By default current directory for windows service is System32.
This link might be helpfull: