c# - process.start changes environment variables -
i have batch file running process.start() in c#. here code:
process proc = new process(); proc.startinfo.filename = cmd; proc.startinfo.arguments = args; proc.startinfo.redirectstandardoutput = false; proc.startinfo.useshellexecute = true; proc.start(); proc.waitforexit(); return proc.exitcode; when open command line , type echo %programfiles% returns c:\program files. inside of batch file (which being run c# proc.start() call), expands %programfiles% , equals c:\program files (x86). can't figure out why happening , it's breaking code. how can fix , why happening?
most because c# code being compiled x86 , windows wants keep backwards compatibility program files points x86 version.
compile 64-bit , point 64-bit program files folder.
now if want program run on x86 versions of windows need compile x86 , add manual handling situation.
Comments
Post a Comment