联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off for /f "usebackq delims=" %%a in ("f:\1 2\list.txt") do set "#%%a==" for %%a in (*.bmp) do for /f "tokens=1* delims=_" %%b in ("%%a") do ( setlocal enabledelayedexpansion set c=%%c if defined #%%b if /i "!c:~0,4!"=="test" echo.文件%%a符合规则:_前为list中存在._后为test加任意字符 Endlocal) pause
Originally posted by Hanyeguxing at 2010-6-2 21:06: 1,可以使用findstr构建表达规则 2,可以使用对字符串的截取、替换、分隔等后,然后用if进行判断构建规则。示例:[code] @echo off for /f "usebackq de ...
@echo off for /f "usebackq delims=" %%i in (test.txt) do move "E:\image\%%i*.bmp" "F:\test\%%i" pause
@echo off for /f "delims=" %%i in (test.txt) do ( if not exist "F:\test\%%i\" md "F:\test\%%i" move "E:\image\%%i*.bmp" "F:\test\%%i") pause
@echo off for /f "usebackq delims=" %%i in ("test.txt") do ( if not exist "F:\test\%%i\" md "F:\test\%%i" move "E:\image\%%i*.bmp" "F:\test\%%i") pause
Originally posted by Hanyeguxing at 2010-6-2 21:24: [code]@echo off for /f "delims=" %%i in (test.txt) do ( if not "F:\test\%%i\" md "F:\test\%%i" move "E:\image\%%i*.bmp" "F:\test\%%i") pause[/c ...
if exist "a.txt" echo 成功 else echo 失败 这样一条语句中, 如果 存在a.txt 的话的话,运行的结果是: “成功 else echo 失败” 就是把第一个echo 后面的都显示出来了,应该怎么修改下了?
if exist "a.txt" (echo 成功) else echo 失败
if exist a.txt (echo.存在) else echo.不存在
if exist a.txt ( echo.存在 ) else echo.不存在
if exist a.txt (echo.存在) else (echo.不存在)
if exist a.txt (echo.存在) else ( echo.不存在 )
if exist a.txt ( echo.存在 ) else ( echo.不存在 )