Computing.Net > Forums > Programming > %%~Za wierdness

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

%%~Za wierdness

Reply to Message Icon

Original Message
Name: Mechanix2Go
Date: December 28, 2007 at 04:37:14 Pacific
Subject: %%~Za wierdness
OS: w2k sp3
CPU/Ram: PIII 933/256MB
Model/Manufacturer: brand x
Comment:

The first section works as expected. In the second FOR the %%~Za fails. Any ideas? TIA

::==
for /f "tokens=* delims= " %%a in ('dir/b') do (
echo %%~Za %%~Na %%a %%~Da
)

for /f "tokens=* delims= " %%a in ('dir/b ..\*.txt') do (
echo %%~Za %%~Na %%a %%~Da
)



=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Message For Removal


Response Number 1
Name: IVO
Date: December 28, 2007 at 05:13:41 Pacific
Reply: (edit)

The %%~Za in tbe second For fails because the z modifier works if and only if your current directory is the same holding the files you are browsing.


Report Offensive Follow Up For Removal

Response Number 2
Name: Razor2.3
Date: December 28, 2007 at 18:17:17 Pacific
Reply: (edit)

Better version:

for %%a in (..\*.txt) do @(
echo %%~Za %%~Na %%a %%~Da)


Report Offensive Follow Up For Removal

Response Number 3
Name: Mechanix2Go
Date: December 28, 2007 at 23:57:01 Pacific
Reply: (edit)

My heros; right, as usual.

;)


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software