chadmanvb
asked on
program files dir with with Windows 7 using .net
I'm testing some of my software to make sure it works with Windows 7. My current software uses a command like:
Process.Start("C:\Program Files\myapp\myapp.exe", "test", pwd, "mydomain")
I can I code this to work with both XP and Windows 7. Currently it fails on Windows 7 because it's looking in the x86 folder.
Process.Start("C:\Program Files\myapp\myapp.exe", "test", pwd, "mydomain")
I can I code this to work with both XP and Windows 7. Currently it fails on Windows 7 because it's looking in the x86 folder.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
well i thought i should share this as well, here is the code to tell you if you are running your app on 64 bit windows or not:-
http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net
probably then you can decide to look for in program files(86) folder for you app.exe
http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net
probably then you can decide to look for in program files(86) folder for you app.exe
Another thing to keep in mind is that Win 7 wont allow your program to access program files folder unless its running in admin mode.
ASKER
This worked great.
That will work as long as the user hasn't got Program Files folder set up on an alternate drive, like D:
Environment.GetFolderPath(
In previous versions:
VS2008-2010
Open in new window
VS2005
Open in new window