Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » The Strongest DOS Command – for (It is a good resource for novices to learn the FOR statement)
View 53,110 Replies 259
Credits 7 Posts 8 Joined 2008-08-30 08:57 17-year member UID 124547 Gender Male
Status Offline
for /f "tokens=5 skip=5" %1 in (1.txt) do @if exist %1 @echo %1
The LZ owner, this doesn't work. Please verify. I'm running it on Windows 2003, and 1.txt is in the same directory.
Content of 1.txt:
Volume in drive D is DATA
Volume Serial Number is C47C-9908
Directory of D:\tmp
09/26/2001 12:50 PM 18,426 alg0925.txt
12/02/2001 04:29 AM 795 bsample.txt
04/11/2002 04:18 AM 2,043 invitation.txt
4 File(s) 25,651 bytes
0 Dir(s) 4,060,700,672 bytes free