Thursday, April 28, 2011

How to use newline character in text in cmd batch?

I would like to do

svn commit -m "<message>"

But message should have two lines:

Commit by: firstuser
Bug track: 9283

How to add new line character into message? I've tried SHIFT+ENTER, CTRL+T but it does not work. I use MS cmd command line.

From stackoverflow
  • Try something like this:

    echo Message1 & echo Message2 & echo Message3

    tomaszs : How to solve my problem with this approach?
  • 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)

    tomaszs : I've tried it. I have new line in command window, but SVN gets only first line.
  • How about using the -F parameter to get the log message from a file?

    Then, you could do this (untested):

    ECHO Commit by: firstuser>SvnLog.txt
    ECHO Bug track: 9283>>SvnLog.txt
    
    SVN COMMIT -F SvnLog.txt
    
    tomaszs : Looks like it's only solution
  • 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 comments:

Post a Comment