%programfiles% in windows inconsistent
-
Hi
I have created a .bat file for troubleshooting and found an interesting behavior, maybe somebody can explain why it works this way:first line runs
echo "%programfiles%">path.txtwhen I run the bat from a QProcess and check path.txt showing
"C:\Program Files (x86)"when I run the bat by windows cmd i get path.txt showing
"C:\Program Files"why is that?
-
Hi
I have created a .bat file for troubleshooting and found an interesting behavior, maybe somebody can explain why it works this way:first line runs
echo "%programfiles%">path.txtwhen I run the bat from a QProcess and check path.txt showing
"C:\Program Files (x86)"when I run the bat by windows cmd i get path.txt showing
"C:\Program Files"why is that?
why is that?
You haven't said what type of app you're running, but apparently it's a 32bit application, so Windows puts you in the 32bit environment and
%programfiles%
points to the 32bit program files directory, which isC:\Program Files (x86)
.cmd
is a 64bit app so it runs in 64bit environment and%programfiles%
points to 64bit program files directory, which isC:\Program Files
.Note that if you'd run cmd from the
C:\Windows\SysWOW64\
directory instead of the default one fromC:\Windows\System32\
you'd get the 32bit version and%programfiles%
would also point toC:\Program Files (x86)
. -
S Seb Tur has marked this topic as solved on