Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:16:31+00:00 2026-06-10T00:16:31+00:00

This seems so simple, but has turned out to be such a pain. On

  • 0

This seems so simple, but has turned out to be such a pain.

On Windows 7, I can paste the below into a command prompt and have it set ProgramFiles(x32) to either %programfiles% or %programfiles(x86)%:

%comspec% /c if exist "%programfiles%" (set "ProgramFiles(x32)=%programfiles%") else (set %ProgramFiles(x32)=%programfiles(x86)%")

However on Windows XP, using the the same and others methods, I cannot get the same result:

E:\>%comspec% /c if exist "%programfiles%" (set "ProgramFiles(x32)=%programfiles%") else (set "ProgramFiles(x32)=%programfiles(x86)%")
E:\Program was unexpected at this time.

E:\>%comspec% /c if exist "%programfiles%" (set ProgramFiles(x32)=%programfiles%) else (set ProgramFiles(x32)=%programfiles(x86)%)
E:\Program was unexpected at this time.

E:\>%comspec% /c if exist "%programfiles%" (set "ProgramFiles(x32)"="%programfiles%") else (set "ProgramFiles(x32)=%programfiles(x86)%")
E:\Program was unexpected at this time.

E:\>%comspec% /c if exist "%programfiles%" (set ProgramFiles(x32)="%programfiles%") else (set ProgramFiles(x32)=%programfiles(x86)%)
"E:\Program Files") was unexpected at this time.

E:\>%comspec% /c if exist "%programfiles%" (set ProgramFiles(x32)=%%programfiles%%) else (set ProgramFiles(x32)=%programfiles(x86)%)
%E:\Program was unexpected at this time.

set ProgramFiles(x32)=%programfiles% works fine straight from the command line on both Win XP & 7.

What AM I missing?

As a side note, I REALLY wish Microsoft would have made %ProgramFiles% be the directory for 32 bit programs. I can’t see the logic in having to do this checking, when it were that way a 32 bit program would be in the same location regardless of the bitage of the OS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:16:33+00:00Added an answer on June 10, 2026 at 12:16 am

    @dbenham Very in depth, and very much appreciated enlightenment in another question of mine, solves this one as well – Different behaviour of DOS Environment setting, in if statement, in DOS prompt as compared to Windows Shortcut

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems so simple, but has turned out to be such a pain. On
This seems simple but I can't figure it out. I receive post data in
This seems painfully simple, but I can't work out how to do it: I
This seems simple, but I can't figure it out. I have ten categories and
This seems really simple but I can't see that NSNumberFormatter has a function for
This seems like a simple question, but has proven to be difficult to find
I'm sure this question has a simple enough answer, but I can't seem to
This seems like it should be very simple but I can't get it to
This seems like such a simple issue but I cannot find an elegant solution.
this seems like a simple enough question but I can't seem to find a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.