Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using this simple test batch script:

@echo off
echo %ProgramFiles%
echo %ProgramFiles(x86)%

is my output:

"C:\Program Files"
C:\Program Files (x86)

One variable is enclosed in quotes while the other isn't? Is this a bug of some sort, or a simple oversight on my behalf?

share|improve this question
up vote 3 down vote accepted

Strange, I can't reproduce this on my machine (Windows Vista 64-bit SP 1). My output is

C:\Program Files
C:\Program Files (x86)

Are you sure you didn't insert quotes in your echo statement?

share|improve this answer
Hmm... I've rebooted since and now am getting the correct, expected result. I'm fairly positive that there were no quotes in my statements (as that was my first guess). I'll see if I can recreate the issue at all. – Matt Hanson May 17 '09 at 7:20
I'm blaming this one on "late night tinkering". I must have manually added quotes somewhere. Thanks anyways! – Matt Hanson May 21 '09 at 0:19

On W2k8 x64 I get:

c:\temp>echo %ProgramFiles% & echo %ProgramFiles(x86)%
C:\Program Files
C:\Program Files (x86)

If you type "set" you can see what the environment variables are. I get:

ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.