加入收藏 | 设为首页 | 会员中心 | 我要投稿 阜阳站长网 (https://www.0558zz.cn/)- AI行业应用、低代码、混合云存储、数据仓库、物联网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

DOS下的文本遍历和文件遍历代码

发布时间:2020-02-16 05:42:20 所属栏目:MsSql教程 来源:站长网
导读::: VisitF.bat - 对指定路径指定文件进行遍历的程序 :: 第一参数为要遍历的文件(支持通配符),第二参数为要遍历的路径(缺省为C盘根) @echo off :main if [%1]==[] if not exist filelist.txt goto end :init if exist filelist.txt if exist xset.asd

:: VisitF.bat - 对指定路径指定文件进行遍历的程序
:: 第一参数为要遍历的文件(支持通配符),第二参数为要遍历的路径(缺省为C盘根)
@echo off

:main
if [%1]==[] if not exist filelist.txt goto end

:init
if exist filelist.txt if exist xset.asd goto loop
set file=%1
set base=%2
if [%2]==[] set base=c:
dir %base%%file% /s /a /b > filelist.txt
echo e 100 ''set file='' > xset.asd
echo w >> xset.asd
echo q >> xset.asd

:loop
fc filelist.txt nul /n | find " 1:" > setfile.bat
if errorlevel 1 goto restore
debug setfile.bat  nul
call setfile.bat
echo Visiting the file: %file%
:: User specified visit code replace this line
find "%file%" /v  filelist.tx2
copy filelist.tx2 filelist.txt > nul
goto loop

:restore
if exist filelist.txt del filelist.txt
if exist xset.asd del xset.asd
if exist filelist.tx2 del filelist.tx2
if exist setfile.bat del setfile.bat

:end

 

(编辑:阜阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读