Wednesday, 15 January 2014

c# - Directory.GetCurrentDirectory(); reporting wrong path for 2nd exe -



c# - Directory.GetCurrentDirectory(); reporting wrong path for 2nd exe -

this question has reply here:

how start process in same folder executable 3 answers

i have c# application starts c# application b so:

string basedir = appdomain.currentdomain.basedirectory; string path = basedir + "programs\\logging\\"; process logger = new process(); logger.startinfo.filename = system.io.path.combine(path, "logger.exe"); logger.start();

in logger.exe following:

string dir = directory.getcurrentdirectory(););

but tells me dir directory of original programme launched it, not own directory (programs\logging)

why this??

that right directory. it's working directory launched process from. if want alter it, like:

string basedir = appdomain.currentdomain.basedirectory; string path = basedir + "programs\\logging\\"; process logger = new process(); // here's deal logger.startinfo.workingdirectory = path; logger.startinfo.filename = system.io.path.combine(path, "logger.exe"); logger.start();

c# .net

No comments:

Post a Comment