Reputation: 423
What is the default directory for WorkingDirectory if it is not defined when using ProcessStartInfo?
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = @"cscript.exe";
//startInfo.WorkingDirectory = "C:\NotDefined";
Upvotes: 1
Views: 508
Reputation: 7573
The WorkingDirectory
, if not set, will be the default %SystemRoot%\system32.
The function of the property depends however on the UseShellExecute
flag:
MSDN:
When the UseShellExecute property is false, gets or sets the working directory for the process to be started.
When UseShellExecute is true, gets or sets the directory that contains the process to be started.
Upvotes: 2
Reputation: 16983
You can use the startInfo.WorkingDirectory
property to set it.
If the property is not set, the default working directory is %SYSTEMROOT%\system32
.
Upvotes: 1