In the project that I am currently working on, I begin an external process. However, the external process is an EXE of a complex program that downloads current user information from a user folder. The desktop shortcut for the program resolves the issue by setting the "Target:" parameter to X:\exepath\prgm.exe and setting the "Enter input" parameter to the user path, X:\exepath\users\username .
I am currently running a process like this:
Process p = new Process(); p.StartInfo = new ProcessStartInfo( "X:\exepath\prgm.exe" ); p.StartInfo.WorkingDirectory = "X:\exepath\users\username"; p.Start(); while (!p.HasExited) { }
However, when the process starts, the program starts the search for all resources in WorkingDirectory instead of pulling user-generated content from this folder and all other content from the directory where the EXE is located. This assumes that the Working Directory and the system shortcut "Start In:" parameter behave differently.
Is there a way to reproduce this behavior using a C # process? Also, is it possible to create a shortcut in C # that I could start with my process call?
Please let me know if further information is helpful.
EDIT -
After some trial and error, I decided to use WSH to create a shortcut and run it. WSH uses the name WorkDirectory for the value of the Start at: parameter. It behaves the same under the hood, like the process execution in my code above. I am still getting the error.
source share