Issue with getting System.Diagnostics.Process to execute a command line with right arguments
Posted on 2010-09-02
I have this very strange issue with a process that executes a command line (that talks to tumbleweed secure transport client) from a .NET Windows Service. This works fine from a windows forms application, strangely but not from a Windows Service. I am running as "Local System". Here's my code snippet from the service:
string batchFile = @"C:\temp\MyBat_TEMP.bat";
System.Diagnostics.ProcessStartInfo procStartInfo =
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
//procStartInfo.WorkingDirectory = @"C:\temp";
process1 = new System.Diagnostics.Process();
process1.StartInfo = procStartInfo;
Here's my batch file content (1 line):
stclient httpsu://<clienthostname>:443/BulkImport/to/ C:\ToSend\AMC_NT_6_201009021000.csv /prefNoAskSched /Remote-Site <RemoteSIteName>
It looks like the stclient is being called but with incorrect arguments WHEN i run from a windows service. Same code runs fine from an exe.
Does anyone know if anything needs to be done differently with the arguments to an exe when we run from a windows service vs an exe.
Any help is appreciated!