DOS batch: SET variable and ECHO it within (…) block

后端 未结 3 1208
梦毁少年i
梦毁少年i 2021-02-05 23:31

I had a problem with set not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls...

The sc

3条回答
  •  别跟我提以往
    2021-02-06 00:07

    User delayed expansion and ! instead of %

    @echo off
    setlocal enableextensions enabledelayedexpansion
    set a=aaa
    echo a = "%a%"
    (
    set b=bbb
    echo b = "!b!"
    )
    

提交回复
热议问题