26

Is it possible to have mutliple lines in command line (CMD)? Something like

"C:\Program Files\WinRAR\WinRAR.exe" a 
aaa.txt.hpp, 
bbb.txt, 
ccc.txt

instead of

"C:\Program Files\WinRAR\WinRAR.exe" a aaa.txt.hpp, bbb.txt, ccc.txt
sleske
  • 22,652
  • 10
  • 69
  • 93
vico
  • 2,379
  • 12
  • 39
  • 60

1 Answers1

30

Is it possible to have multiple lines in command line?

Yes, you can do this by escaping the EOL character, like so:

"C:\Program Files\WinRAR\WinRAR.exe" a ^
aaa.txt.hpp, ^
bbb.txt, ^
ccc.txt

where ^ is the escape character.


Further Reading

Vomit IT - Chunky Mess Style
  • 40,038
  • 27
  • 84
  • 117
DavidPostill
  • 153,128
  • 77
  • 353
  • 394
  • But how to type EOL from keyboard? – vico Jun 23 '17 at 08:57
  • 2
    @vico Use the Enter key ... which inserts the appropriate EOL character(s) – DavidPostill Jun 23 '17 at 08:58
  • @vico EOL means "End Of Line". There's more than one way shells do this, but your kernel manages it via your Enter key, so you never see exactly what's happening. It's usually not a problem unless you try to take text files formatted for one shell over to another. – user287352 May 10 '19 at 22:18
  • unfortunately, you can't paste multiline commands into a command prompt... it treats each line as a separate command – Greg Woods Dec 09 '19 at 19:08