ok, my turn: %~zI not working in FOR

December 3, 2009 at 19:49:25
Specs: Windows Xp klunker
n(o)brane wants to know:
why doesn't this work?

setlocal enabledelayedexpansion
for /d %%A in (friggit.txt) do (
set dontwork=%~zA
echo %%A
echo dontwork)

which should yield the size of friggit.txt but instead generates:

The following usage of the path operator in batch-parameter
substitution is invalid: %~zA

friggit.txt exists in the cur.dir of the batchfile
(the echo of %%A confirms as friggit.txt)

the battlefield is littered with the twisted bodies of percents, exclms, echo's, sets, and FOR's. It works on %1, %2 etc, either setdelayed or not, but refuses to work from inside the FOR or reflected after the expiration of FOR loop. made sure to use only the FOR variable (%%A) and not a substitute.
I know I'm missing something really really simple... (my brain!)


See More: ok, my turn: %~zI not working in FOR

Report •


#1
December 3, 2009 at 20:06:21
@echo off & setLocal EnableDELAYedExpansion

for /f "tokens=* delims= " %%a in (filelist) do (
echo %%~Za
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
December 3, 2009 at 20:25:39
i just KNOW i tried that variation, but there was so much flak laying around, it might have got mixed up in all the dead bodies of variables and percents and exclamations. Also have to watch out for global environment var. interference I've learned the hard way. thanks

(walking away, shaking his head, muttering "I KNOW I tried that...)


Report •

#3
December 3, 2009 at 20:51:47
coffee time, boys & girls


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
December 4, 2009 at 06:01:06
coffee time, boys & girls

Yey! Coffee!

Three cups please, and leave the pot.


Batch Variable how to


Report •

#5
December 4, 2009 at 09:27:12
coffee time, boys & girls

Thanks for offering! I'd love some coffee & girls please. I'll skip the boys though.


Report •

#6
December 5, 2009 at 00:23:42
Hi klint,

A hybrid, perhaps?

http://violet-fire.com/Monica4.JPG


=====================================
Helping others achieve escape felicity

M2


Report •


Ask Question