|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『楼 主』:
如何查找一天内17:00-17:25创建的所有文件?
使用 LLM 解释/回答一下
如何查找一天内17:00-17:25创建的所有文件?
@echo off
set /p d=请输入完整的路径:
set /p strTime=请输入文件的创建时间:
for /f "tokens=3,*" %%i in ('dir /a-d/od/t:C "%d%"^|find ^"%strtime%^"') do (echo %%j>>d:\22.txt)
pause
这样的我会,查找一定时间范围内,我不会,有哪位能帮我改一下?
How to find all files created between 17:00 and 17:25 in one day?
@echo off
set /p d=Please enter the full path:
set /p start_time=Please enter the start time of the file creation:
set /p end_time=Please enter the end time of the file creation:
for /f "tokens=3,*" %%i in ('dir /a-d/od/t:C "%d%" ^| findstr /b /c:"%start_time%" /c:"%end_time%"') do (echo %%j>>d:\22.txt)
pause
I know this part. I don't know how to find within a certain time range. Can anyone help me modify it?
|
|
2006-11-26 07:33 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
试试这个,每个输入都要标准,日期范例:2006-11-25,时间范例(二十四小时制的):09:20、23:50
@echo off
set/p d_=请输入要查找的路径(默认当前文件夹):
set/p date_=请输入查询的文件的创建日期:
if not defined date_ goto error
set/p time1=输入起始时间:
if not defined time1 goto error
set/p time2=请输入结束时间:
if not defined time2 goto error
cls
echo 查找结果:&&echo;
for /f "skip=5 tokens=1,2,4*" %%a in ('dir /a-d/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% if not %%b geq %time2% (
echo %%c
)
)
pause
goto :eof
:error
echo 输入错误
pause
Last edited by lxmxn on 2006-11-27 at 10:21 AM ]
Try this, each input should be standard, date example: 2006-11-25, time example (24-hour system): 09:20, 23:50
@echo off
set/p d_=Please enter the path to search (default current folder):
set/p date_=Please enter the creation date of the file to query:
if not defined date_ goto error
set/p time1=Enter start time:
if not defined time1 goto error
set/p time2=Please enter end time:
if not defined time2 goto error
cls
echo Search results:&&echo;
for /f "skip=5 tokens=1,2,4*" %%a in ('dir /a-d/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% if not %%b geq %time2% (
echo %%c
)
)
pause
goto :eof
:error
echo Input error
pause
Last edited by lxmxn on 2006-11-27 at 10:21 AM ]
|
|
2006-11-26 08:40 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
我试了一下,查不到结果的,代码还应再改一下呀.
I tried it, but couldn't find the result. The code should be modified further.
|
|
2006-11-26 08:58 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Re tianzizhi :
不会吧,我试了可以呀,除非你输入的日期或者时间的格式不对,或者在你指定的时间或者日期内没有任何文件。
Last edited by lxmxn on 2006-11-26 at 09:15 AM ]
Re tianzizhi :
No way, I tried it and it worked. Unless the date or time you entered is in the wrong format, or there are no files within the time or date you specified.
Last edited by lxmxn on 2006-11-26 at 09:15 AM ]
|
|
2006-11-26 09:14 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
@echo off
set/p d_=请要查找的路径输入路径(默认当前文件夹):
:error
set/p date_=请输入查询的文件的创建日期:
if not defined date_ goto error
set/p time1=输入起始时间:
if not defined time1 goto error
set/p time2=请输入结束时间:
if not defined time2 goto error
cls
echo 查找结果:&&echo;
for /f "tokens=1,2,4*" %%a in ('dir /a-d/od/tc "%d_%" ^| find "%date_%"') do if %%b geq %time1% if not %%b geq %time2% echo %%c
pause
```batch
@echo off
set/p d_=Please enter the path to be searched (default current folder):
:error
set/p date_=Please enter the creation date of the file to be queried:
if not defined date_ goto error
set/p time1=Enter the start time:
if not defined time1 goto error
set/p time2=Please enter the end time:
if not defined time2 goto error
cls
echo Search results:&&echo;
for /f "tokens=1,2,4*" %%a in ('dir /a-d/od/tc "%d_%" ^| find "%date_%"') do if %%b geq %time1% if not %%b geq %time2% echo %%c
pause
```
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2006-11-26 09:15 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
|
2006-11-26 09:28 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
我的文件创建时间是:16:16:48,我把开始时间设为16:15,结束时间设为16:17。结果没有找到。但如果把开始时间设为16:14就能找到,是为什么?
我重新建立一个文件,结果时间怎么设,都能找到。然后,我又按照上面的时间设了一遍,结果找到了。
我认为dos有时也是不稳定的,就像操作系统一样,其实dos也是一种操作系统吧。不知道,这样的理解对不对
另外,我想在全盘比如,c或d盘,进行时间段的查找文件,应该怎么添加代码?
Last edited by anqing on 2006-11-26 at 10:20 AM ]
The creation time of my file is: 16:16:48. I set the start time to 16:15 and the end time to 16:17. As a result, no file was found. But if I set the start time to 16:14, I can find it. Why is that?
I created a new file again. No matter how I set the time, I can find it. Then, I set the time as above again, and as a result, I found it.
I think DOS is sometimes unstable, just like an operating system. Actually, DOS is also a kind of operating system, right? I don't know if this understanding is correct.
In addition, I want to perform a time period search for files on the entire disk, such as drive C or D. How should I add code?
Last edited by anqing on 2006-11-26 at 10:20 AM ]
|
|
2006-11-26 09:54 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
另外,如果我想在c盘内进行查找,这个p也是找不到
In addition, if I want to search in the C drive, this p can't find it either
|
|
2006-11-26 10:06 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
我想在全盘比如,c或d盘,进行时间段的查找文件,应该怎么添加代码?
等了一天了,怎么没有人回答?
I want to search for files in a time period on the entire disk, such as drive C or D. How to add code?
Waited a day, why no one answers?
|
|
2006-11-27 06:34 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
wmic datafile where "InstallDate>'20061126200000.000000+480' and drive='d:' and InstallDate<'20061126230000.000000+480'" get caption
上面是查找2006年11月26号20点到23点间D盘下创建的文件的例子,你可以自己指定盘符,目录等等其他过滤条件。
p.s:如果全盘搜索的话可能会运行太长时间而导致“没有响应”(文件数目较大时)。
wmic datafile where "InstallDate>'20061126200000.000000+480' and drive='d:' and InstallDate<'20061126230000.000000+480'" get caption
The above is an example of finding files created on drive D between 20:00 and 23:00 on November 26, 2006. You can specify the drive letter, directory, and other filtering conditions by yourself.
P.S: If you search the entire disk, it may run for too long and cause "not responding" (when the number of files is large).
此帖被 +3 点积分 点击查看详情 评分人:【 lxmxn 】 | 分数: +3 | 时间:2006-11-27 13:04 |
|
|
|
2006-11-27 13:01 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
谢谢版主,我想在上面的批处理中实现指定时间段,对整个盘符进行搜索
Thank you, moderator. I want to implement searching the entire drive letter within a specified time period in the above batch processing.
|
|
2006-11-27 21:59 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
@echo off
set/p d_=请要查找的路径输入路径(默认当前文件夹):
set/p date_=请输入查询的文件的创建日期:
if not defined date_ goto error
set/p time1=输入起始时间:
if not defined time1 goto error
set/p time2=请输入结束时间:
if not defined time2 goto error
cls
echo 查找结果:&&echo;
for /f "skip=5 tokens=1,2,4*" %%a in ('dir /a-d/s/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% if not %%b geq %time2% (
echo %%c
)
)
pause
goto :eof
:error
echo 输入错误
pause
谁帮我改改,以达到能搜索整个盘符,和指定路径中创建的文件。
@echo off
set/p d_=Please enter the path to be searched (default current folder):
set/p date_=Please enter the creation date of the file to be queried:
if not defined date_ goto error
set/p time1=Enter start time:
if not defined time1 goto error
set/p time2=Please enter end time:
if not defined time2 goto error
cls
echo Search results:&&echo;
for /f "skip=5 tokens=1,2,4*" %%a in ('dir /a-d/s/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% if not %%b geq %time2% (
echo %%c
)
)
pause
goto :eof
:error
echo Input error
pause
To modify it to search for files created in the entire drive letter and specified paths, you can change "%d_%" to "D:\" (assuming you want to search drive D, adjust according to actual situation) and handle the input to support both entire drive and specific paths. For example:
@echo off
set /p d_=Please enter the path to be searched (enter the drive letter directly to search the entire drive, such as D:):
if "%d_"=="" set d_=.
set/p date_=Please enter the creation date of the file to be queried:
if not defined date_ goto error
set/p time1=Enter start time:
if not defined time1 goto error
set/p time2=Please enter end time:
if not defined time2 goto error
cls
echo Search results:&&echo;
for /f "skip=5 tokens=1,2,4*" %%a in ('dir /a-d/s/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% if not %%b geq %time2% (
echo %%c
)
)
pause
goto :eof
:error
echo Input error
pause
|
|
2006-11-27 22:24 |
|
|
zhoung0
初级用户
 
积分 54
发帖 18
注册 2005-11-5
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
lxmxn..如果符合条件的文件中含有空格 echo %%c 只能显示一部分..应该用echo %%c %%d 吧.
@echo off
set /p d_=请输入要查找的路径(默认当前文件夹):
if not defined d_ (set d_=%cd%)
echo 已经设置查询路径为%d_%
set /p date_=请输入查询的文件的创建日期:
if not defined date_ (for /f %%a in ("%date%") do (set date_=%%a))
echo 已经设置查询创建日期为%date_%的文件。
set /p time1=输入起始时间:
if not defined time1 (set time1=00:00)
set /p time2=输入结束时间:
if not defined time2 (set time2=24:00)
cls
echo 查找结果: && echo.
for /f "tokens=1,2,3,4*" %%a in ('dir /a-d/s/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% (
if %%b leq %time2% (
echo %%d %%e
)
)
)
echo.
pause >nul
Last edited by zhoung0 on 2007-1-11 at 04:32 AM ]
lxmxn..If the file that meets the conditions contains spaces, echo %%c can only display part of it..Should use echo %%c %%d bar.
@echo off
set /p d_=Please enter the path to be searched (default current folder):
if not defined d_ (set d_=%cd%)
echo The query path has been set to %d_%
set /p date_=Please enter the creation date of the file to be queried:
if not defined date_ (for /f %%a in ("%date%") do (set date_=%%a))
echo The file with the creation date %date_% has been set.
set /p time1=Enter the start time:
if not defined time1 (set time1=00:00)
set /p time2=Enter the end time:
if not defined time2 (set time2=24:00)
cls
echo Search results: && echo.
for /f "tokens=1,2,3,4*" %%a in ('dir /a-d/s/od/tc "%d_%" ^| find "%date_%"') do (
if %%b geq %time1% (
if %%b leq %time2% (
echo %%d %%e
)
)
)
echo.
pause >nul
Last edited by zhoung0 on 2007-1-11 at 04:32 AM ]
|
|
2007-1-11 04:17 |
|
|
ben1985
新手上路

积分 2
发帖 1
注册 2007-2-10
状态 离线
|
『第 14 楼』:
请教一下anqing
使用 LLM 解释/回答一下
anqing你好!
我的需求和你差不多,我是要把每天晚上九点和前一天晚上九点生成的文件找出来。
我是一个新新手,不知道该怎么编这个批处理程序,请您帮忙看一下
Anqing hello!
My requirement is similar to yours. I need to find out the files generated at 9 PM every day and 9 PM the previous day.
I'm a complete beginner and don't know how to compile this batch processing program. Please help me take a look
|
|
2007-2-12 12:23 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
@echo off
setlocal enabledelayedexpansion
set /p time1=输入起始时间(格式HH:MM:SS):
set /p time2=输入结束时间(格式HH:MM:SS):
set StartTime=%date:~0,4%%date:~5,2%%date:~8,2%%time1:~0,2%%time1:~3,2%%time1:~6,2%
set EndtTime=%date:~0,4%%date:~5,2%%date:~8,2%%time2:~0,2%%time2:~3,2%%time2:~6,2%
wmic datafile where "InstallDate>'%StartTime%.000000+480' and drive='d:' and InstallDate<'%EndtTime%.000000+480'" get caption>Result.txt
这个貌似只查.dat文件啊怎么改全部?
@echo off
setlocal enabledelayedexpansion
set /p time1=Enter start time (format HH:MM:SS):
set /p time2=Enter end time (format HH:MM:SS):
set StartTime=%date:~0,4%%date:~5,2%%date:~8,2%%time1:~0,2%%time1:~3,2%%time1:~6,2%
set EndtTime=%date:~0,4%%date:~5,2%%date:~8,2%%time2:~0,2%%time2:~3,2%%time2:~6,2%
wmic datafile where "InstallDate>'%StartTime%.000000+480' and drive='d:' and InstallDate<'%EndtTime%.000000+480'" get caption>Result.txt
This seems to only check.dat files. How to change it to all?
|
|
2007-2-12 13:18 |
|