Welcome!
By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser .
Space within path and FOR
Hi,
I'm trying following (example):
set SPATH=G:\My Dropbox\Dropbox
for /F %%I in ("%SPATH%\bootloader.img") do @echo bootloader.img %%~tI
and expecting:
bootloader.img 28.06.13 14:24
but I get a 'file not found' on "G:\My".
How do I use spaces within a path in this context?
Thanks
Exo
How do I use spaces within a path in this context?
Thanks
Exo
One option is the @QUOTE function.
Example;
Code:
set SPATH=%@quote[G:\My Dropbox\Dropbox]
Look in the help file for the @QUOTE function.
Joe
Hi Joe,
thanks for you reply, but unfortunately your tip does not work. The result is the same as in my example (file not found on "G:\My")
Exo
"tokens=*" should fix the problem with the space (which you'd also have with CMD), but that seems to be broken in TCC. Here's a simple one in CMD.
Code:
C:\Users\vefatica> for /F "tokens=*" %a in ("v:\a b.txt") do echo %a
C:\Users\vefatica> echo v:\a b.txt
v:\a b.txt
And here it is in TCC.
Code:
v:\> for /F "tokens=*" %a in ("v:\a b.txt") do echo %a
ECHO is OFF
It's hard to tell if the "~t" will work. It does in CMD:
Code:
C:\Users\vefatica> for /F "tokens=*" %a in ("v:\a b.txt") do echo %~ta
C:\Users\vefatica> echo 2013-06-28 09:52
2013-06-28 09:52
P.S. The quotes here "%SPATH%\bootloader.img" tell FOR that it's a string as opposed to a file to read. They don't group it into a single token. So you will have to use "tokens=*" (if it works) to get the whole string returned in one variable.