Andrey Bushman
Andrey Bushman

Reputation: 12476

Can I separate some long expression of BAT file into several lines?

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?

Upvotes: 0

Views: 45

Answers (1)

Archie
Archie

Reputation: 2672

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"

Upvotes: 1

Related Questions