Created
November 30, 2012 18:24
-
-
Save timheuer/4177553 to your computer and use it in GitHub Desktop.
batch with spaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET arch=%processor_architecture% | |
SET pf="C:\Program Files" | |
if "%arch%" == "AMD64" ( | |
SET pf="C:\Program Files (x86)" | |
) | |
REM below fails because "pf" has spaces in it | |
REM using "%pf%\bar\baz\file.foo" also fails because then it looks at %pf% as a literal | |
copy \\some\path\file.foo %pf%\bar\baz\file.foo |
See my fork.
Your SET commands are wrong. Try set pf=C:\Program Files (x86)
. (Don't put quotation marks.)
Oh, I had missed jessenic's fork. That should also work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
copy \\some\path\file.foo '%pf%\bar\baz\file.foo'
doesn't work?