我找到了这段代码,但有些部分我不明白。
这是我的代码:
主要.bat:
@echo off
set "CallCount=0"
set "Mood="
set /P "Mood=Your mood is: "
call Receive.bat "%Mood%"
rem *Random stuff*
set "Food="
set /P "Food=The food you want is: "
call Receive.bat "%Food%"
set "CallCount="
接收.bat:
@echo off
set /A CallCount+=1
if "CallCount"=="2" goto Call2
if not "%~1"=="" echo %1 <----
*Random Stuff* |
goto :EOF |---What is %~1 doing in this area?
:Call2 |
if not "%~1"=="" echo %1 <----
rem Commands for second call.
编辑:这是一个使用两次调用命令的文件。
%1
是调用命令行的第一个参数。如果传递的参数有引号,%1
包括引号。然而,%~1
提供删除引号的参数值。
有用的参考here http://ss64.com/nt/syntax-args.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)