Tho*_*phe 0 windows integer cmd batch-file
我想在Windows上创建一个批处理文件,可以让用户只输入1-31之间的数字......我可以在批处理文件中稍后使用这个数字......有可能吗?
我试过这个
set /P "month=Enter the month of the year : "
findstr /i %month% %file% | sort /+24
Run Code Online (Sandbox Code Playgroud)
谢谢 :)
@echo off
:try_again
set /P "month=Enter the month of the year : "
echo %month%|findstr /r "[^0-9]" && (
echo enter a number
goto :try_again
)
::clears the leading zeroes.
cmd /c exit /b %month%
set /a month=%errorlevel%
if %month% gtr 31 (
echo enter a number between 1 and 31
goto :try_again
)
if %month% lss 1 (
echo enter a number between 1 and 31
goto :try_again
)
Run Code Online (Sandbox Code Playgroud)
?
| 归档时间: |
|
| 查看次数: |
2904 次 |
| 最近记录: |