How to use newline character in text in cmd batch?

后端 未结 12 1845
忘掉有多难
忘掉有多难 2020-12-31 07:08

I would like to do

svn commit -m \"\"

But message should have two lines:

Commit by: firstuser
Bug track: 92         


        
相关标签:
12条回答
  • 2020-12-31 07:33

    This works for us:

    private static final char LF = (char) 13;

    setMessage("Test"  + LF + "Jij" + LF + "Dit" + LF + "Effe");
    
    0 讨论(0)
  • 2020-12-31 07:35

    I use the following method and it works:

    svn commit {list of files to commit}
    

    After typing the above command and pressing enter, an editor will open. Write your comment there and exit the editor. Upon exiting the editor, the commit command will execute and whatever you wrote in the editor will be committed too.

    0 讨论(0)
  • 2020-12-31 07:39

    The Problem is that "enter" (Ascii 13) sends the command. So you need a "newline"

    use alt + 10 (press alt, type the number at the numberblock, release alt)

    0 讨论(0)
  • 2020-12-31 07:40

    I had the same problem and while Claes Mogren's answer does not work with cmd.exe it made me think if there's a shell on Windows that could do that.
    And of course there is... PowerShell.

    Using PowerShell shell you can achieve this using following command:

    svn ci -m "reference to Ninject fixed`nsome ignores added"
    

    Notice the combination of backqoute and n in the message

    `n
    
    0 讨论(0)
  • 2020-12-31 07:42

    I found the answer over at Serverfault:

    svn ci -m $'This is the first line\nThis is the second line'
    

    Apparently it's a shell-problem.

    0 讨论(0)
  • 2020-12-31 07:42

    Try something like this:

    echo Message1 & echo Message2 & echo Message3

    0 讨论(0)
提交回复
热议问题