Batch basis (nine) receives user input information

file_exist.bat follows:
Note: set /pthe command, / p representation allows user input as a variable value, no new knowledge in this section.

@echo off
:again
cls
echo.
echo.
echo ######################请选择要执行的操作######################
echo ----------------------1、输入数字1并按回车,显示当前日期----------------------
echo ----------------------2、输入数字2并按回车,显示当前时间----------------------
echo ----------------------3、输入数字3并按回车,显示文件列表----------------------
echo ----------------------4、输入任何其它字符,终止批处理   ----------------------
echo.
echo.
echo 请选择要执行的操作
set /p num=

if "%num%"=="1" (
cls
echo.
echo.
echo 当前日期为:
date/t
pause
goto again
)

if "%num%"=="2" (
cls
echo.
echo.
echo 当前时间为:
time/t
pause
goto again
)

if "%num%"=="3" (
cls
echo.
echo.
echo 当前文件列表:
dir /w
pause
goto again
)

echo.
echo.
echo 输入了%num%字符,批处理自动推出。

Here Insert Picture Description

Published 228 original articles · won praise 44 · Views 100,000 +

Guess you like

Origin blog.csdn.net/qq_40945965/article/details/86749073