Windows Batch Scripting Issue - Quoting Variables containing spaces
Posted
by Rick
on Stack Overflow
See other posts from Stack Overflow
or by Rick
Published on 2010-04-10T03:07:02Z
Indexed on
2010/04/10
3:13 UTC
Read the original article
Hit count: 463
So here's my issue: I want to use %cd% so a user can execute a script anywhere they want to place it, but if %cd% contains spaces, then it will fail (regardless of quotes). If I hardcode the path, it will function with quotes, but if it is a variable, it will fail.
Fails: (if %cd% contains spaces) "%cd%\Testing.bat"
Works: "C:\Program Files\Testing.bat"
Any ideas?
© Stack Overflow or respective owner