How to check command line parameter in “.bat” file?

后端 未结 7 2067
无人共我
无人共我 2020-12-13 02:00

My OS is Windows Vista. I need to have a \".bat\" file where I need to check if user enters any command-line parameter or not. If does then if the parameter equals to

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 02:22

    In addition to the other answers, which I subscribe, you may consider using the /I switch of the IF command.

    ... the /I switch, if specified, says to do case insensitive string compares.

    it may be of help if you want to give case insensitive flexibility to your users to specify the parameters.

    IF /I "%1"=="-b" GOTO SPECIFIC
    

提交回复
热议问题