Do Batch files support multiline variables

前端 未结 9 2025
南旧
南旧 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:21

    If you just wanted to use it for outputting the lines of variables, I hope this would be useful to you.


    Inspired by something, I found this working.

    For codes in normal Command Prompt:

    set this=echo hi ^& echo bye

    %this%

    It gives out the two following two lines:

    hi
    bye
    

    in the Command Prompt window.


    The reason for using the ^ character:

    Command Prompt would identify that you wanted to run two commands so that you need to add this character, that tells Command Prompt to recognize the next character as a symbol and not to do any special thing for it.

提交回复
热议问题