You are not logged in.
Pages: 1
SET _lfn=c:\my documents\lfn.txt
FOR /F "tokens=1* delims==" %%G IN (%_lfn%) DO SET %%G=%%H
A problem I had for a long time now, but is it possible to use for commands with a long file name, or do you need it to be in the same directory to process for commands? I tried double quotes and single quotes but they didnt work, maybe the context is wrong
Last edited by NDog (23 Mar 2007 04:15)
cmd, vbs, ps, bash
autoit, python, swift
Offline
you missed an underscore
SET _lfn
or else just use %lfn%
Offline
For once, Windows Help has all the answers. Important bits are in bold...
<snip>
or, if usebackq option present:
FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]<snip>
usebackq - specifies that the new semantics are in force,
where a back quoted string is executed as a
command and a single quoted string is a
literal string command and allows the use of
double quotes to quote file names in
file-set*.<snip>
*I've corrected the slightly misleading original word that is here.
Thus your corrected FOR statement would need to look something like this:
FOR /F "usebackq tokens=1* delims==" %%G IN ("%_lfn%") DO SET %%G=%%H
Last edited by bluesxman (23 Mar 2007 09:49)
cmd | *sh | ruby | chef
Offline
Good point, I've just edited the FOR /F page to add that usebackq option.
thanks bluesxman
Offline
Pages: 1