Do Batch files support multiline variables

前端 未结 9 1958
南旧
南旧 2020-12-25 12:54

If so How?

Yes, batch files are lame, but I cannot use powershell, and I don\'t feel like writing a real app to do this simple task....

edit

9条回答
  •  北海茫月
    2020-12-25 13:10

    This is a pretty old question, but I put together a hybrid of the solutions from @Fabricio and @jeb that both worked correctly and added some readability:

    setlocal enableDelayedExpansion
    set NL=^
    
    
    rem two empty line required
    set var=this is a !NL! ^
    multi !NL! ^
    line !NL! ^
    string !NL!
    
    echo !var!
    

提交回复
热议问题