I have an exe calling a second exe. Both written on c# sitting in the same folder.
In the arguments passed to the second exe there is the path of a file. The file is read in the second exe.
All works fine except when the file is located in the user’s profile app folder and the profile is stored on the network.
The path is constructed with this:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + SubFolderAndFileName
The first exe reads the file with no problems but the second exe gets an error of file does not exist.
This is the code launching the second exe:
Process p = new Process();
p.StartInfo.Arguments = Args;
p.StartInfo.FileName = "second.exe";
p.Start();
Thank you for any help.
You need to make sure the path is in quotes. It’s highly likely that it will contain spaces (XP’s
AppDatafolder isC:\Documents and Settings\User\Application Data, which will mean that the portions of the path are treated as two different arguments, ex:C:\Program Files\My Company\My ProgramAs an unquoted string becomes:
Probably not what you want, and likely to cause problems.