Hello newbie looking for some help. I am trying to write a script to search all files and folders in my drive which have a certain identifier. For example "ID -"
I was using the following to get files and directories listed in a log file:
dir ID * /A:-D-H /B /S >> C:\FileCatalogue.log 2>> C:\FileCatalogue.log
dir ID * /A:D-H /T:C /S >> C:\DirCatalogue.log 2>> C:\DirCatalogue.log
However I want the output to be in 3 tabbed columns:
FILE {tab} DIR {tab} ID
ID123 - YYYY - myfile.txt {tab} C:/tmp/tmp {tab} ID123 - YYYY
etc..
etc...
Any help would be greatly appreciated! Victor
尝试这个:
for /f "tokens=1*delims=-" %%a in ('dir /a-d/b ID*') do echo %%a-%%b %cd% %%a
@echo off
for /f "delims=" %%A in ('dir /a:-d-h /b /s /t:c ID123*') do for /f "tokens=1,2,* delims=-" %%B in ("%%~nxA") do echo(%%~nxA %%~dpA %%B-%%C
Output
ID123 - YYYY - myfile.txt C:\Users\User\Desktop\ ID123 - YYYY
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.