zimmer9
asked on
How to run an exe file in the same directory as the input file for a C# console application using VS2010?
How would you recode the attached C# Console application so that the executable can run in the same directory as the input file? Currently the exe runs fine as long as it is not in the same directory path as the input file. When I put the exe in the same directory as the input file, the Visual Studio Just-In-Time Debugger appears.
test.txt
test.txt
If you need to you can get the path the currently running EXE using:
string startupPath = System.IO.Path.GetDirector yName(Syst em.Reflect ion.Assemb ly.GetEntr yAssembly( ).Location );
string startupPath = System.IO.Path.GetDirector
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Instead of passing a path plus the filename just passed the filename without any path information something like the following.
Open in new window