Batch file fails to set environment variable within conditional statement

后端 未结 3 1397

Why does the following Windows Batch File output Foo followedby Bar, rather than Baz?

@echo off
setlocal

set _=Foo
echo %         


        
3条回答
  •  别跟我提以往
    2021-02-13 10:57

    try this

    @echo off
    setlocal
    
    set _=Foo
    echo %_%
    set _=Bar
    if "1" NEQ "2" goto end
    set _=Baz
    echo %_%
    :end
    

提交回复
热议问题