Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

- Batch Characters - Characters that causes errors when tried to echo -

What are characters that would cause errors when tried echoing?
For example...

Code
echo Hello! I love putting |'s on my thread titles!
pause

It would close automatically because of the pipe, (|) that I put.
So that's only one character. Any other characters?
(Oct 28, 2012 12:43 AM)DAVEologist Wrote:  What are characters that would cause errors when tried echoing?
For example...

Code
echo Hello! I love putting |'s on my thread titles!
pause

It would close automatically because of the pipe, (|) that I put.
So that's only one character. Any other characters?

To get past that put a ^ infront of it IE: ^| and it will work.
He trying to figure out the characters that give the error.

try echoing these

:[]zxcvbnm,.'/@!\#$%^&*()_;{}<>"?+àáâãäåæçèéêëìíîïðñòóôõöøœùúûüýÿþßšžāăąćċčďēěėęğġģħīįiıijķĺļľłńņňőŕřśşťūůűųźżƒdždzțαβγδεζηθικλμνξοπρστυφχψωάέήίόύώϊϋΐΰς΄΅абвгдеёжзийклмнопрстуфхцчшщъыьэюяÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØŒÙÚÛÜÝŸÞߊŽĀĂĄĆĊČĎĒĚĖĘĞĠĢĦĪĮİIIJĶĹĻĽŁŃŅŇŐŔŘŚŞŤŪŮŰŲŹŻƒDžDzȚΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΆΈΉΊΌΎΏΪΫΐΰςАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ¿¡←→↑↓√@§¶†‡|¦–—¤$¢€£¥™©®×÷=±∞ƒºª«»~„"“”^ˇ˘˙¸˛˜′″µ°¹²³♭♪•…¬¯%‰¼½¾⇒⇔●◆*****▲▼☆★♀♂
(Oct 28, 2012 01:39 AM)WOLGA Wrote:  He trying to figure out the characters that give the error.

try echoing these

:[]zxcvbnm,.'/@!\#$%^&*()_;{}<>"?+àáâãäåæçèéêëìíîïðñòóôõöøœùúûüýÿþßšžāăąćċčďēěėęğġģħīįiıijķĺļľłńņňőŕřśşťūůűųźżƒdždzțαβγδεζηθικλμνξοπρστυφχψωάέήίόύώϊϋΐΰς΄΅абвгдеёжзийклмнопрстуфхцчшщъыьэюяÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØŒÙÚÛÜÝŸÞߊŽĀĂĄĆĊČĎĒĚĖĘĞĠĢĦĪĮİIIJĶĹĻĽŁŃŅŇŐŔŘŚŞŤŪŮŰŲŹŻƒDžDzȚΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΆΈΉΊΌΎΏΪΫΐΰςАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ¿¡←→↑↓√@§¶†‡|¦–—¤$¢€£¥™©®×÷=±∞ƒºª«»~„"“”^ˇ˘˙¸˛˜′″µ°¹²³♭♪•…¬¯%‰¼½¾⇒⇔●◆*****▲▼☆★♀♂

Uhhh... can you please choose non-unicode text? I can't save my Batch file with those.
The characters are these: ^<>%&|

The quote character " can also cause trouble in certain circumstances though not in echo.
The following script would crash:
Code
set abc=hello"world
if "%abc%"=="bla" echo Bla

Parentheses () can also ruin grouping of commands.
This script would also crash as the ) in the echo would end the grouping before the programmer had intended.
Code
if 1==1 (
  echo Hello ) World
  pause>nul
  )

And you can't display ! with delayedexpansion enabled.
Code
setlocal enabledelayedexpansion
echo Hello World!

You can use the escape character ^ to display these special characters (except !).
(Oct 28, 2012 03:17 AM)SoulByte Wrote:  The characters are these: ^<>%&|

The quote character " can also cause trouble in certain circumstances though not in echo.
The following script would crash:
Code
set abc=hello"world
if "%abc%"=="bla" echo Bla

Parentheses () can also ruin grouping of commands.
This script would also crash as the ) in the echo would end the grouping before the programmer had intended.
Code
if 1==1 (
  echo Hello ) World
  pause>nul
  )

And you can't display ! with delayedexpansion enabled.
Code
setlocal enabledelayedexpansion
echo Hello World!

You can use the escape character ^ to display these special characters (except !).

Cool. Very useful indeed. :)
Thanks for the share!
(Oct 28, 2012 03:17 AM)SoulByte Wrote:  And you can't display ! with delayedexpansion enabled.

You can use the escape character ^ to display these special characters (except !).

You can display the exclamation mark by escaping it three times.

Code
@echo off
setlocal enabledelayedexpansion
echo Hello World^^^!
(Oct 28, 2012 01:32 PM)G T X Wrote:  You can display the exclamation mark by escaping it three times.

Code
@echo off
setlocal enabledelayedexpansion
echo Hello World^^^!

I tried that before and it didn't work for me...the only way I could get it to work was to disable setlocal.
(Oct 28, 2012 01:32 PM)G T X Wrote:  You can display the exclamation mark by escaping it three times.

Code
@echo off
setlocal enabledelayedexpansion
echo Hello World^^^!

Actually, you only need to escape it two times.

Code
@echo off
setlocal enabledelayedexpansion
echo Hello World^^!
In the land of the blind, the one-eyed man is king
Blood makes you related, but loyalty makes you family
(Oct 28, 2012 02:48 PM)SIM-1073426 Wrote:  Actually, you only need to escape it two times.

Code
@echo off
setlocal enabledelayedexpansion
echo Hello World^^!

Since the normal functionality of the caret would cause it to protect itself, then it later has the ability to protect the ! then I guess that would be the easiest solution. Any more than 3 would cause extra carets to be displayed, and the third would do nothing (as it doesn't normally show up when it is protecting something).


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 217 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Python] by Mr. RobotSep 11, 2022 12:33 AM 1 155 Sep 11, 2022 12:33 AM
Last Post: 570RM
[Shell] by Nulla MisericordiaFeb 14, 2020 02:23 PM 0 162 Feb 14, 2020 02:23 PM
Last Post: Nulla Misericordia