为什么以下批处理代码崩溃?

时间:2014-05-23 03:22:18

标签: batch-file

为什么这段代码会崩溃? (批处理或MS DOS) 如果这是一个愚蠢的问题,我是编程的新手,很抱歉。

    echo set var=string>>batch.bat
    call batch.bat
    If %var%==string goto LABEL

1 个答案:

答案 0 :(得分:1)

batch.bat(因为你要为它添加一行)吗? 您的代码中没有:LABEL,因此GOTO失败。

试试这个:

@echo off
echo set var=string>batch.bat
call batch.bat
If %var%==string goto :LABEL
:LABEL
echo this is the end
pause
相关问题