Space within path and FOR

Apr 20, 2011
21
0
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
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
 
May 20, 2008
11,536
103
Syracuse, NY, USA
"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
 
May 20, 2008
11,536
103
Syracuse, NY, USA
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.
 
Similar threads
Thread starter Title Forum Replies Date
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
rps Fixed @filesize[...,a] space allocated values incorrect Support 2
vefatica @FILESIZE ... allocated space Support 7
Joe Caverly Echo message works without the space? Support 3
jbanaszczyk Alias with space in the name Support 3
vefatica WAD @FILEREADB outputs a leading space ... Support 2
C How to? MOVE and handling out of space Support 2
aedthuio Folder with space char Support 6
vefatica START /DESKTOP="name with space" ... Support 4
W File completion without space/executable extensions Support 3
Stefano Piccardi replace tcc process space? Support 8
H variable programfiles(x86) loses space Support 1
D unzip /d in directory with space in name Support 1
thorntonpg removing directory with space at the end Support 3
V Set path permanently from within TCC? Support 3
cgunhouse Ctrl-C from within a library function Support 6
D What is the limit on the compound statement length within ( ) of a FOR-loop? Support 5
Alpengreis How to? Copy & Paste without linebreak within TCMD Support 13
T 64 bit TCCLE appears to crash when opening tcc.exe from within tcc.exe window Support 7
D Internal variable _tctabs within TCExit Support 9
nickles WAD Variable name gets changed within FOR loop Support 2
A How to? Filter a list by numeric number within filename Support 28
M Invoking a DOS command within a C++ program Support 1
thedave Detach from Tab within a BTM? Support 0
S LOG within a batch file Support 1
Jay Sage Command Will Not Run Using Short Name of Path Support 5
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
D How to? Path problems in TCC20 Support 1
vefatica "COMSPEC path" Support 2
Patulus TCHistoryLog: TCC: (Sys) The system cannot find the path specified Support 15
vefatica If there's no PATH variable ... Support 5
D V19: toolbar /r "path\tctoolbar.ini" Support 1
C ECHOing the _CWD with a & in the path Support 7
David McClelland How to? Path Changes Support 4
gschizas Fixed Cannot use extended path to delete invalid file Support 3
nickles Fixed In batch files, %0 now evaluates to the absolute path Support 9
cgunhouse IFTP Path Issue in V17 - Fixed Support 7
M How to? List path getting short file and directory names... Support 10
M How to? Get both path to and target of symbolic link/junction... Support 2
N Command completion and PATH Support 0
noahcoad How to? Create shortcut with env var in path Support 4
A WAD Dir daterange + multiple path wildcards crashes tcc Support 2
D TCC can't start app if @shfolder[42] used for path Support 1
fpefpe How to? Path(s) for Python Support 0
D TPIPE works without being in path, but not V; aemail Support 8
Stefano Piccardi IDE.exe start toobar button fails when % in script path Support 0
H 12.10 UNZIP ignores destination path spec Support 2
Phileosophos unzip not using specified path Support 5

Similar threads