Reputation: 99
No idea whats going on here, so I hope someone can help.
I have a batch file that echos this:
echo +--------------------------------------------------------------------------+
echo | Booking System |
echo | By IT Department |
echo +--------------------------------------------------------------------------+
echo | IF YOU CAN SEE THIS, SOMETHING BROKE! |
echo +--------------------------------------------------------------------------+
echo | IF YOU CAN NOT SEE THE BOOKING INTERFACE,PLEASE USE THE PHONE AND DIAL 0 |
echo +--------------------------------------------------------------------------+
echo | |
echo +--------------------------------------------------------------------------+
But when I run the script, is gives me a Syntax error:
+--------------------------------------------------------------------------+
The syntax of the command is incorrect
Upvotes: 3
Views: 1446
Reputation: 881263
The problem lies with:
echo | Booking System |
The |
is the pipe character which takes the output of the echo
and tries to connect it to the standard input of a program called Booking
(which probably doesn't exist) using the argument System
, and then taking the output of that program and piping through to, well, nothing.
Hence the error, a syntax error caused by the final pipe with no program to run.
You should escape the pipe characters thusly:
echo ^| these will be treated as literal bar characters ^|
See the following transcript which shows a coup[le of errors caused by unescaped pipes (including the second one which matches your case) and the fix:
C:\users\Pax\Documents> echo | hello there
'hello' is not recognized as an internal or external command,
operable program or batch file.
C:\users\Pax\Documents> echo | hello there |
The syntax of the command is incorrect.
C:\users\Pax\Documents> echo ^| hello there ^|
| hello there |
Upvotes: 5