0

How can I split some long expression of BAT file into several lines (for convenient reading)? For example, I have a long line:

call "%NUNIT%\nunit-console.exe" /out="%~dp0%file_name%.out" /err="%~dp0%file_name%.err" /noshadow /xml="%~dp0%file_name%.xml" "%~dp0%file_name%.dll"

I want to get the more readable variant, for example three lines instead of one:

call "%NUNIT%\nunit-console.exe" /out="%~dp0%file_name%.out" 
  /err="%~dp0%file_name%.err" /noshadow /xml="%~dp0%file_name%.xml" 
  "%~dp0%file_name%.dll"

But it doesn't work. How can I do it?

Andrey Bushman
  • 10,992
  • 14
  • 77
  • 163
  • possible duplicate of [Long commands split over multiple lines in Vista/DOS batch (.bat) file](http://stackoverflow.com/questions/69068/long-commands-split-over-multiple-lines-in-vista-dos-batch-bat-file) – Ken White Jun 19 '15 at 14:49

1 Answers1

1

Use '^' character to split the line:

call "%NUNIT%\nunit-console.exe" ^
/out="%~dp0%file_name%.out" ^
/err="%~dp0%file_name%.err" ^
/noshadow ^
/xml="%~dp0%file_name%.xml" ^
"%~dp0%file_name%.dll"
Archie
  • 2,596
  • 20
  • 21