Weird scope issue in .bat file

前端 未结 3 1694
小鲜肉
小鲜肉 2020-12-16 12:27

I\'m writing a simple .bat file and I\'ve run into some weird behavior. There are a couple places where I have to do a simple if/else, but the code inside the blocks don\'t

3条回答
  •  [愿得一人]
    2020-12-16 13:29

    Looks like the read and write use different scoping rules.

    If you eliminate this line

    set MODE=FOOBAR
    

    it will work as expected. So you'll probably need to have a complex series if if/elses to get the variables populated as you'd like.

提交回复
热议问题