联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
CODE: [Copy to clipboard]@echo off setlocal enabledelayedexpansion for /f "skip=1 eol== tokens=1,2 delims=." %%i in (test.txt) do ( echo %%i|find "d:\dos">nul 2>nul && set new=%%i echo f:\new\!new:~7!.%%j>>1.txt ) del /q test.txt ren 1.txt test.txt start test.txt
CODE: [Copy to clipboard]@echo on :: 比较目录1中存在,目录2中相应位置不存在的文件。 :: %1为目录1 :: %2为目录2 set a=%time% if exist d:\f1.txt del d:\f1.txt /q if exist d:\f2.txt del d:\f2.txt /q dir %1\ /s /b > d:\f1.txt type d:\f1.txt cls setlocal enabledelayedexpansion for /f "eol== tokens=1 delims=/" %%i in (d:\f1.txt) do ( echo %%i|find "%1">nul 2>nul && (set new=%%i set result=!new:%1=%2! if not exist !result! (echo !result:%2=%1!>>d:\f2.txt) ) ) @echo off cls echo. set b=%time% echo 您的比较结果放在d:\f3.txt中。 echo 开始时间:%a% echo 结束时间:%b% pause>nul
CODE: [Copy to clipboard]@echo off set str=d:\dos\dos\ :: 字符串中不能出现引号 set num=0 :loop set str=%str:~0,-1% set /a num+=1 if not "%str%"=="" goto loop echo 字符个数为 %num% 个 pause