Batch - Echo or Variable Not Working

后端 未结 2 600
醉梦人生
醉梦人生 2021-01-30 19:36

I have this little batch script:

SET @var = \"GREG\"
ECHO %@var%
PAUSE

When I run it, it prints:

H:\\Dynamics>SET @var = \"G         


        
相关标签:
2条回答
  • 2021-01-30 20:15

    Try the following (note that there should not be a space between the VAR, =, and GREG).

    SET VAR=GREG
    ECHO %VAR%
    PAUSE
    
    0 讨论(0)
  • 2021-01-30 20:24

    Dont use spaces:

    SET @var="GREG"
    ::instead of SET @var = "GREG"
    ECHO %@var%
    PAUSE
    
    0 讨论(0)
提交回复
热议问题