中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-07 20:51
48,041 topics / 350,128 posts / today 3 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » Help modifying code to search the whole drive for a specified date found on the forum!
Printable Version  1,426 / 14
Floor1 5872169 Posted 2008-03-06 12:30
高级用户 Posts 474 Credits 959
I saw a piece of code on the forum! Please have an expert modify it! After finding the file, show the path. The code below doesn't show the path after finding the file!
cd\&dir/a/s/tc *.exe|findstr /bc:"2008-03"

[ Last edited by 5872169 on 2008-3-6 at 12:40 PM ]
Floor2 plp626 Posted 2008-03-06 13:13
银牌会员 Posts 1,020 Credits 2,278
Please reply in that thread of mine and I'll give you a detailed explanation
Floor3 moniuming Posted 2008-03-13 18:19
银牌会员 Posts 574 Credits 1,335 From 广西
Not sure if this is what you want:
Floor4 moniuming Posted 2008-03-13 18:36
银牌会员 Posts 574 Credits 1,335 From 广西
Oh, no! After testing, I found that the listed directory is the directory where the batch file is run.
Floor5 moniuming Posted 2008-03-13 19:04
银牌会员 Posts 574 Credits 1,335 From 广西
This one passed the test:
Floor6 5872169 Posted 2008-03-13 19:15
高级用户 Posts 474 Credits 959
moniuming, it didn't pass the test, it says the directory name and volume label syntax is incorrect!!

[ Last edited by 5872169 on 2008-3-13 at 07:16 PM ]
Floor7 terse Posted 2008-03-13 19:58
银牌会员 Posts 946 Credits 2,404
Floor8 5872169 Posted 2008-03-13 21:48
高级用户 Posts 474 Credits 959
terse, the test succeeded, but if I enter 2008-03-13 it doesn't work!
Floor9 moniuming Posted 2008-03-13 22:00
银牌会员 Posts 574 Credits 1,335 From 广西
Floor10 moniuming Posted 2008-03-13 22:02
银牌会员 Posts 574 Credits 1,335 From 广西
Didn't see the refreshed content again, sheesh
terse's code only shows up to the month
Floor11 5872169 Posted 2008-03-13 22:09
高级用户 Posts 474 Credits 959
moniuming, I just tried it, and it passed the test now
Floor12 moniuming Posted 2008-03-13 22:09
银牌会员 Posts 574 Credits 1,335 From 广西
I found the problem in the code on post #5:
for /f "tokens=1,3* delims= " %%i in ('dir /s /a-d /tc "%%i:\*.exe"^|findstr "2008-03"') do (
the red part should be %%a
Floor13 terse Posted 2008-03-14 01:21
银牌会员 Posts 946 Credits 2,404
Originally posted by 5872169 at 2008-3-13 21:48:
terse, the test succeeded, but if you enter 2008-03-13 then it doesn't work!

Try changing !t:~0,7! to !t:~0,10!
Floor14 plp626 Posted 2008-03-14 17:46
银牌会员 Posts 1,020 Credits 2,278
Originally posted by terse at 2008-3-13 07:58 PM:
@echo off&setlocal enabledelayedexpansion
for %%a in (c d e f) do for /f "delims=" %%i in ('dir /s /b /a-d "%%a:\*.exe"') do set t=%%~ti&if "!t:~0,7!" == &quo ...


What %~fi gets is not the real path of the file being searched.
Floor15 terse Posted 2008-03-14 22:57
银牌会员 Posts 946 Credits 2,404
Originally posted by plp626 at 2008-3-14 17:46:


%~fi does not give the real path of the file being searched.

What path do you get over there?
What I get here is!
c:\WINDOWS\Installer\{A9FF0492-05E5-F426-3104-3DDA813E2E23}\ARPPRODUCTICON.exe
c:\WINDOWS\Installer\{C5F2DBF1-6A08-39D2-9871-BF8F29F73C88}\ARPPRODUCTICON.exe
c:\WINDOWS\Installer\{C849D7B5-DCE7-9080-687E-CF5D3D535190}\ARPPRODUCTICON.exe
c:\WINDOWS\Installer\{D63B08C9-50B9-D513-083C-BF9310149C35}\ARPPRODUCTICON.exe
d:\Desktop\WinMount_setup.exe
d:\Desktop\CrabFLV\CrabFLV.exe
d:\Temp\HKFX2008__OK.exe
e:\Program Files\360\uninst.exe
e:\Program Files\360\SoftMgr\esslibupdate.exe
e:\Program Files\VPP3\pp31setup.exe
e:\Program Files\VPP3\Update\pp31setup.exe
f:\Program Files\utorrent\utorrent.exe
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023