Need help with paths in XP and Vista.

Skyzoomer

Member
I'm writing a batch file which calls a 32 bit .exe program. I want it to be compatible with the different Windows operating systems. The problem is that the path to "Program Files" is different depending which OS is being used. For instance:

I know the paths for these OS' since I use them:
- WinXP 32 bit: C:\Program Files\
- Vista 64 bit: C:\Program Files (x86)\

Could some kind souls please tell me what the 32bit paths are for:
- WinXP 64 bit:
- Vista 32 bit:

And for Windows 7 also would be nice:
- Win7 32 bit:
- Win7 64 bit:

Thanks!
Sky
 

My Computer

Environment variable - Wikipedia, the free encyclopedia

Look down in the section called "system path variable" for %ProgramFiles%.
Some other good stuff on that page as well.:D
Gil
Hi Gil,

Thanks for that nice link. Very informative.

Unfortunately the %ProgramFiles% variable did not work for me. Here's a sample of both paths I used in my batch file on my WinXP PC:

"C:\Program Files\ImgBurn\ImgBurn" ........ <= This works fine.
"C:\%ProgramFiles%\ImgBurn\ImgBurn" .... <= This fails.

Any ideas?

==========

EDIT: Reading your link in more detail, my problem is to determine whether a 32bit or 64bit version OS is running, not whether it is XP or Vista. Apparently 32bit XP or Vista uses \Program Files\ and 64bit XP or Vista uses \Program Files (x86)\.

I'll have to google how to determine whether 32bit or 64bit for my batch file.

Thanks!
 

My Computer

Leave the quotes off.. Call it thusly:

%ProgramFiles%\ImgBurn\ImgBurn

Try that.

Gil

Environment variable - Wikipedia, the free encyclopedia

Look down in the section called "system path variable" for %ProgramFiles%.
Some other good stuff on that page as well.:D
Gil
Hi Gil,

Thanks for that nice link. Very informative.

Unfortunately the %ProgramFiles% variable did not work for me. Here's a sample of both paths I used in my batch file on my WinXP PC:

"C:\Program Files\ImgBurn\ImgBurn" ........ <= This works fine.
"C:\%ProgramFiles%\ImgBurn\ImgBurn" .... <= This fails.

Any ideas?
 

My Computer

System One

  • Manufacturer/Model
    Dell Inspiron Notebook
    Internet Speed
    2.5 Mbit/s
Leave the quotes off.. Call it thusly:

%ProgramFiles%\ImgBurn\ImgBurn

Try that.
Gil
Yes, after finally understanding that the %ProgramFiles% is just a shortcut for "C:\Program Files" (without the quotes), I can see how your suggestion can work.

But there is also a %ProgramFiles(x86)% variable for 64bit systems.

It would have been ideal if %ProgramFiles% automatically handled 32 or 64 bit systems and just inserted the correct path. But it evidently still remains the user's task to determine 32 or 64 bit and use the correct variable.

Thanks a lot for your help. I've learned quite a bit and what I need to do now because of it.

Sky
 

My Computer

I'm not sure about XP 64 bit but in Vista, and I assume Windows Seven, 64 bit versions, if it is 64 bit, this file exists:
%windir%\syswow64\explorer.exe

which should usually expand to
c:\windows\syswow64\explorer.exe

That's the 32 bit shell. In fact if you check the tutorials there's one of mine to create a shortcut to open the 32 bit explorer on 64 bit Vista. Some 32 bit program's shell extensions will work if you open Explorer using that copy of explorer.exe(see HalfShell in free programs for Vista list for more info.)

If you are on a 32 bit system that "syswow64" folder won't exist.
 

My Computer

System One

  • Manufacturer/Model
    HP Pavilion m9515y
    CPU
    Phenom X4 9850
    Memory
    8 GB
    Graphics card(s)
    Some Radeon Cheapie with 512 MB Ram
    Monitor(s) Displays
    CRT
    Screen Resolution
    1280x1024
    Hard Drives
    750 GB SATA 3G 2 SIIG Superspeed docks w/WD Caviar Black Sata II or III
I'm not sure about XP 64 bit but in Vista, and I assume Windows Seven, 64 bit versions, if it is 64 bit, this file exists:
%windir%\syswow64\explorer.exe

which should usually expand to
c:\windows\syswow64\explorer.exe

That's the 32 bit shell. In fact if you check the tutorials there's one of mine to create a shortcut to open the 32 bit explorer on 64 bit Vista. Some 32 bit program's shell extensions will work if you open Explorer using that copy of explorer.exe(see HalfShell in free programs for Vista list for more info.)

If you are on a 32 bit system that "syswow64" folder won't exist.
Thanks!
Sky
 

My Computer

Back
Top