Batch file unable to access Program files X86

12,878

Solution 1

The use of single or double quotes referenced by @GeekyDaddy & mentioned initially by @DavidPostill - is whats required.

The 8.3 equivalent is as praise worthy.

Another tip to get exact / literal paths in (CMD) command-prompt is to start with a quoted string ("C:\P") such as:

"C:\P"

tab + tab + ... # & so-forth for each suggestion

This would give you suggestion which it ought to auto-complete for first / every match thereafter depending on the number of characters you'd typed. A belated version of bash-completion by 20+ years :-)

Solution 2

There are two way to do this.

  1. Use Double-quotes as stated by @DavidPostill
  2. Use the respective 8.3 name "PROGRA~2".

To determine the 8.3 name of the folder:

  • Open a command prompt
  • Type "dir /x" this will list the files and folder and their respective 8.3 notation
Share:
12,878

Related videos on Youtube

user595035
Author by

user595035

Updated on September 18, 2022

Comments

  • user595035
    user595035 almost 2 years

    I need to be able to run a simple ROBOCOPY on a backup file that is location in: C:\Program Files (x86). I get an error when I try to test I get an error saying that it doesn't like the x86. I have also tried %programfiles% and that didn't resolve it either.

    I appreciate any help!

    • DavidPostill
      DavidPostill about 8 years
      Use "s around names with spaces.
    • dave_thompson_085
      dave_thompson_085 about 8 years
      Note that %programfiles% is (64-bit) C:\Program Files; if you want to use the variable (which you don't need to) for (32-bit) C:\Program Files (x86) it's %programfiles(x86)%.
    • user595035
      user595035 about 8 years
      The quotes totally worked! Thanks! I really appreciate your help!
    • barlop
      barlop over 5 years
      You should really have included the line, then shown if it's really just a batch file issue(unlikely) or if it's also generally from the command line in which case nothing to do with batch files
    • Michael Harvey
      Michael Harvey over 5 years
      @barlop - this was 2.5 years ago.
    • barlop
      barlop over 5 years
      @MichaelHarvey so what. Somebody else can view this question, this site is primarily a QnA database, and both a Q and an A should be quality
    • Michael Harvey
      Michael Harvey over 5 years
      Comments are not answers.
  • user595035
    user595035 about 8 years
    Great info! I really appreciate it. I am just learning how all this stuff works and I really appreciate the direction you have given!
  • user595035
    user595035 about 8 years
    Thanks GeekyDaddy, I tried the 8.3 trick first, but I don't think the directory included the 8.3 name (as far as I could tell, but that might be user error as opposed to it not being there :))