I have a C# code that starts a "custom action", usually a .bat file that installs/re-installs a Windows service on a machine, but my application only knows that this custom action can be started using Process.Start(). Custom action is triggered when my application downloads files to a user defined folder. This is my folder structure: "new" contains new files, "service" contains files for running a windows service.
My batch file looks like this:
net stop DataExchangeProxyService
installutil /u .\service\DataExchangeProxyService.exe
copy .\new\*.* .\service
installutil .\service\DataExchangeProxyService.exe
net start DataExchangeProxyService
PAUSE
Problem is when i start a process from C# with "runas" verb, then a current directoy is "C:\Windows\System32..."
Process process = new Process();
ProcessStartInfo startinfo = new ProcessStartInfo();
startinfo.FileName = Path.Combine(this.destinationFolder, customAction);
startinfo.Verb = "runas";
process.StartInfo = startinfo;
process.Start();
This way my process cannot find those files because it doesn't run in a destination folder. Batch file has to be like this because it cannot contain absolute paths. How to make a process stay in current destination folder?