Space within path and FOR

Apr 20, 2011
21
0
#1
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
 
Apr 20, 2011
21
0
#3
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
 
#4
"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
 
#5
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.