Reputation: 21801
Paths are relative to current directory. I've tried tons of combinations of quoting, unquoting, changing to a parent directory and removing the ..
, but I always get a FileNotFound error when I try to launch a process.
bridge_process = System.Diagnostics.Process.Start(
@"../Tools/RunHidden",
@"../My-Bridge.bat");
Upvotes: 0
Views: 536
Reputation: 17130
"Current directory" can in some cases be c:\windows\system32 in my experience.
Try this:
string fullapppath = Assembly.GetExecutingAssembly().Location;
string apppath = System.IO.Path.GetDirectoryName(fullapppath);
string path1 = System.IO.Path.Combine(apppath, @"../Tools/RunHidden");
string path2 = System.IO.Path.Combine(apppath, @"../My-Bridge.bat");
bridge_process = System.Diagnostics.Process.Start(path1, path2);
Upvotes: 1
Reputation: 74530
Instead of passing a relative directory, why not pass a fully-qualified path? You can use the static methods on the Path class in the System.IO namespace to help you create the path.
Upvotes: 1