@echo off
:: 假设批处理所在目录 有9个文件 0.txt 1.txt ...... 9.txt
:: 按参数移动到 D:\DATA 目录
CD /D "%~DP0"
if "%1" == "" Echo 没有参数!脚本退出!&pause >NUL &exit
echo %1| findstr "" && (
Echo 参数错误!不应该有数字以外的字符。
pause >nul & exit
)
set "arg=%1"
:CMP
set "num=%arg:~0,1%"
move "%num%.txt" D:\DATA 2>nul && echo 移动 %num%.txt 到 D:\DATA
call set "arg=%%arg:%num%=%%"
If not "%arg%" == "" goto CMP
echo 任务完成!
pause > nul