I\'m new to script writing and can\'t get this one to work. I could if I moved the files to a path without a space in it, but I\'d like it to work with the space if it coul
There are two options here. First, you can store the path unquoted and just quote it later:
set MyPath=C:\Program Files\Foo
"%MyPath%\foo with spaces.exe" something
Another option you could use is a subroutine which alles for un-quoting strings (but in this case it's actually not a very good idea since you're adding quotes, stripping them away and re-adding them again without benefit):
set MyPath="C:\Program Files\Foo"
call :foo %MyPath%
goto :eof
:foo
"%~1\foo.exe"
goto :eof
The %~1 removes quotation marks around the argument. This comes in handy when passing folder names around quoted but, as said before, in this particular case it's not the best idea :-)