China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

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联盟论坛
The time now is 2026-06-25 08:07
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to add the full path to the file names in the dir result View 5,361 Replies 17
Floor 16 Posted 2006-11-09 07:34 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
It seems that there are conditional restrictions when expanding the path with %%~fi. The code of 12F can indeed accurately get the real absolute path, but this absolute path is obtained by dir, not by expanding with %%~fi. Changing set Name=%%~fa to set Name=%%a has the same effect.

However, the code of 12F has a flaw: when there are files with the same name in different folders, when dir is used again to query, it can only get the file with the same name in one of the directories, not all; I don't understand the purpose of find /v "sequence". Suppose a file name or path name contains the word "sequence", then it will be filtered out?

In addition, in the example of 15F, the format of ^|findstr ".mmf" will find all files whose file names contain mmf, not just files whose suffix is .mmf, because findstr supports regular expressions, and the dot matches any character in the regular expression.

Considering the advantages and disadvantages of various schemes, I think only the method of generating temporary files may be able to meet the requirements of the owner.

[ Last edited by namejm on 2006-11-8 at 08:21 PM ]
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 17 Posted 2006-11-09 08:24 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
1.subst x: "%cd%"
2.wmic datafile where "drive='x:'" get filesize,CreationDate,name
3.subst x: /d
Just put the second step into a for to operate to get the desired result. Due to time constraints, the code is omitted.
Floor 18 Posted 2006-11-09 08:42 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Brother 3742668 is quite powerful, using wmic to an extremely proficient degree, PF.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Forum Jump: