Reputation: 59
Is there any way to specify working directory as below?
Process.Start("c:\someDir\someExecutable.exe + working directory path");
or how to make windows environment variable path work with :
Process.Start("c:\someDir\someExecutable.exe");
I know that ProcessStartInfo can be use to specify working directory.
I have my own reason to for wanting to put working directory and file path in same parameter of Process.Start()
.
Upvotes: 0
Views: 1281
Reputation: 27599
The documentation for public static Process Start(string fileName)
is found here: https://msdn.microsoft.com/en-us/library/53ezey2s(v=vs.110).aspx
As you can see the description for that parameter is:
The name of a document or application file to run in the process.
The remarks also note:
This overload does not allow command-line arguments for the process. If you need to specify one or more command-line arguments for the process, use the Process.Start(ProcessStartInfo) or Process.Start(String, String) overloads.
So in summary no, you can't do this. Even if your program accepted a working directory as a command line argument this overload will not work.
Upvotes: 2