我有一个需要4个命令行输入的批处理文件。当我在命令提示符下执行批处理文件时,它会显示要求输入4个值的帮助消息。
当我直接从文件夹运行此文件时,它会打开cmd并立即关闭。
是否可以修改批处理文件,这样当我从文件夹运行时,它将打开cmd,然后显示帮助信息。?
以下是我的问题的迷你版本,带有1个命令输入。该脚本用于生成许可证文件
@ECHO OFF
GOTO :continue
:continue
SETLOCAL
IF "%1" == "" GOTO :Help
::Set the Command Line Options
SET ARVERSION=%1
::Create Directory
SET OUT_PATH=%cd%
ECHO Initiating Generation...
if not exist %OUT_PATH% mkdir %OUT_PATH%
::Create License File - Calling 'Subs' will create the output with actual Version
Subs ARVERSION %ARVERSION% Input.txt 1>%OUT_PATH%\License.txt
ECHO Scripts are created @ %OUT_PATH%
ECHO Generation Completed...
GOTO :End
:Help
ECHO Starting License File Generation...
ECHO Usage:
ECHO InstallerScriptGen.bat AR_VERSION
ECHO AR_VERSION - Version (3.2 or 4.0 or 4.2)
ECHO Example : InstallerScriptGen.bat 3.2.2
ECHO Please Note that input of incorrect values will result in wrong generation.
:End
ENDLOCAL