Loading... 很多批处理程序程序常常会在程序运行过程中,让你输入参数或做一些选择,如我们常见的YES和NO 这部分功能可通过下面类似的脚本完成。 <div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d59374af-fde7-4a46-9cbb-4a88d974b3b8" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;"> <pre class="brush: bash;">@echo OFF set /p var="Are you want to die?(Y/N)" if %VAR%==Y GOTO DIE if %VAR%==N GOTO ALIVE :DIE ECHO "I will die!" PAUSE GOTO END :ALIVE ECHO "I still alive" VER PAUSE :END</pre> </div> *注:其中 if %VAR%==Y GOTO DIE if %VAR%==N GOTO ALIVE 不能写成 if %VAR%=="Y" GOTO DIE if %VAR%=="N" GOTO ALIVE 否则无法正确运行 Last modification:October 6, 2023 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的文章对你有用,请随意赞赏
2 comments
哈哈,厉害了
第一次飘来