Check if an environment variable is defined without command extensions and without using a batch file?

后端 未结 5 532
南笙
南笙 2020-12-25 10:54

I need to use a cmd.exe command line (cmd.exe is being called from the gyp build tool) to determine whether an environment variable is defined or not. How can I do this? I

5条回答
  •  一向
    一向 (楼主)
    2020-12-25 11:26

    Errr... just:

    if defined your-var-name ( 
        echo yarp
    ) else (
        echo narp
    )
    

    I should add, I do not believe this needs command extensions...

提交回复
热议问题