2

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?

  • 2
    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
7

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

echo foo ^
bar ^
baz

results in:

foo bar baz
  • 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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.