Windows Batch Files: if else

前端 未结 6 833
执笔经年
执笔经年 2020-12-24 00:42

I\'m doing a simple batch file that requires one argument (you can provide more, but I ignore them).

For testing, this is what I have so far.

if not          


        
6条回答
  •  自闭症患者
    2020-12-24 00:57

    An alternative would be to set a variable, and check whether it is defined:

    SET ARG=%1
    IF DEFINED ARG (echo "It is defined: %1") ELSE (echo "%%1 is not defined")
    

    Unfortunately, using %1 directly with DEFINED doesn't work.

提交回复
热议问题