Batch file unable to access Program files X86
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.
- Use Double-quotes as stated by @DavidPostill
- 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
Related videos on Youtube
![user595035](https://lh5.googleusercontent.com/-BYnSdDzcHbM/AAAAAAAAAAI/AAAAAAAAB88/bjdrkyokHcg/photo.jpg?sz=256)
user595035
Updated on September 18, 2022Comments
-
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 about 8 yearsUse
"
s around names with spaces. -
dave_thompson_085 about 8 yearsNote 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 about 8 yearsThe quotes totally worked! Thanks! I really appreciate your help!
-
barlop over 5 yearsYou 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 over 5 years@barlop - this was 2.5 years ago.
-
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 over 5 yearsComments are not answers.
-
-
user595035 about 8 yearsGreat info! I really appreciate it. I am just learning how all this stuff works and I really appreciate the direction you have given!
-
user595035 about 8 yearsThanks 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 :))