Take the 2-minute tour ×

I have a long command line, and I would like to enter it on several lines. Something like the following (if it were possible):

vsdbcmd /a:Deploy /manifest:Database.deploymanifest _
    /p:DeploymentConfigurationFile=Database_Database.sqldeployment _
    /p:SqlCommandVariablesFile=Database_Database.sqlcmdvars _
    /p:TargetDatabase=Database _
    /dd- /cs:"Data Source=production;integrated security=true" _
    /script:DatabaseChanges.sql /dsp:SQL > errors.log 2>&1

Is there a character or sequence of characters that can be used to write a command line on more than one line?

share|improve this question
Out of curiosity, if it's more than one line, and looks as long and as complicated as you specified, why not put it in a bat/cmd file, or better yet, a script (wsh/poweshell)? This would allow you to launch it with one word –  Traveling Tech Guy Aug 19 '11 at 2:29
I intend to put it into a script, but will it run if it's on more than one line? –  John Saunders Aug 19 '11 at 2:52
That is the point of a script/batchfile –  soandos Aug 19 '11 at 2:54
The closest I can see, and it's not for a cmd prompt window but powershell window works for a powershell script too, is stackoverflow.com/questions/2608144/… –  barlop Aug 19 '11 at 2:57
He clearly wants good formatting, so it's very readable. He asked how to do it in a script in his title too. –  barlop Aug 19 '11 at 2:58
show 6 more comments

1 Answer

up vote 8 down vote accepted

Try using '^' as the continuation character. For example:

echo foo ^
bar ^

results in:

foo bar baz
share|improve this answer
Thanks! That works. I first used DOS back in 1983 and never knew this. Is it documented somewhere? –  John Saunders Aug 19 '11 at 15:12
I assume it's documented somewhere but I couldn't tell you where I first saw it. (It also works for escaping '>', '<', and '|'.) –  BillP3rd Aug 19 '11 at 15:58
neat! I never knew this existed. –  Keltari Aug 20 '11 at 7:24
add comment

Your Answer


