npocmaka
Any idea why this breaks the cmd:
Code: Select all
@echo off
rem do not set new lines at the end or you'll break the breaker
echo combobreaker |(>^
Theese will just broke the cmd (not every variation crashes the cmd. Somes just prints empty line , or will echo without new line , here are only this that I found that causes crash of the cmd):
Code: Select all
@echo off
echo combobreaker |)>^
Code: Select all
@echo off
echo combobreaker |(<^^
Code: Select all
@echo off
echo combobreaker |>^
Code: Select all
@echo off
echo combobreaker |(^
Code: Select all
@echo off
echo combo >(|^
And this you'll say that the can't find the called file:
Code: Select all
@echo off
rem file not found
echo combobreaker |)<^^
Code: Select all
@echo off
rem do not set new lines at the end
echo ^
|(>^
----------------------------
#2 02 Nov 2012 12:37
dbenham
I don't see anything unusual with
Code: Select all
@echo off
echo combobreaker |(<^^
Nor do I see anything unusual with
Code: Select all
@echo off
rem do not set new lines at the end or you'll break the breaker
echo combobreaker |)<^^
But all the other versions that end with a single caret fail in some bizarre way. The caret is the escape character - the CMD batch parser wants to read the next character and ignore any special meaning that it might normally have. But there is no next character since you have reached the end-of-file. CMD should detect this error condition and exit the batch script with a nice error message. Obviously the batch parser has a bug and appears to enter some endless loop doing who knows what. The various versions are in different parsing contexts when the bug occurs, which could explain why you get different behaviors (all bad).
Dave Benham
----------------------------
#3 02 Nov 2012 16:04
npocmaka
O yeaah..
Thanks for the hint.
So the whole fun is in the redirecting from/out-to escaped :eof.
Which game the idea to try few other things:
Code: Select all
@echo off
( echo ^
<^
and
@echo off
( echo ^
>^
e:
Code: Select all
@echo off
goto :eof >^
Code: Select all
@echo off
goto :eof <^
Again a lot of GeTokens:
Code: Select all
@echo off
echo combobreaker |( goto :eof >^
Code: Select all
@echo off
echo combobreaker |( goto :eof <^
Just a little bit more ctrl+c-s
Another cmd crashers:
Code: Select all
@echo off
( goto :eof |<^
Code: Select all
@echo off
( goto :eof |>^
Code: Select all
@echo off
( goto :eof >^
Code: Select all
@echo off
( goto :eof <^
Last edited by npocmaka (02 Nov 2012 16:25)
----------------------------
#4 27 Feb 2013 20:59
npocmaka
One more way:
Code: Select all
echo on
break | for %%A in () do echo %%A
but with empty body this crashes the cmd.
And with echo on it prints :
Code: Select all
for %%A in ((nul)) do echo %%A
----------------------------
#5 01 Mar 2013 09:39
jeb
I suppose the full crash with pipes occours, as you can't reach the new cmd.exe with ctrl-c context, build by the pipe.
Carets can crash in many cases.
Code: Select all
set "caret=^"
call echo %%caret%%
jeb
----------------------------
#6 15 Jul 2013 21:19
npocmaka
I've tried some more things with caret and call , and this is the result:
Code: Select all
::breaks the cmd
:: EOF after the caret
break & call ^
----------------------------
#7 15 Jul 2013 22:21
jeb
I like your tests ... but in this case it's not the CALL command that fails with the caret, it's just the caret at the end of file.
Appending a line and the batch works fine.
Or try to replace the CALL with ECHO or even SETLOCAL, they all creates a crash.
----------------------------
#8 16 Jul 2013 00:47
Simon Sheppard
Possibly the shortest batch file that crashes the shell:
Code: Select all
^&^
#9 18 Jul 2013 07:04
npocmaka
Ha!Thanks.Now I'm much better at crashing the prompt
----------------------------
#10 29 Jul 2015 10:39
npocmaka
Code: Select all
@echo off
rem do not set new lines at the end or you'll break the breaker
echo combobreaker |(>^
Fixed there sad
Last edited by npocmaka (29 Jul 2015 10:40)
----------------------------
#11 13 Aug 2015 14:41
npocmaka
...and one more way to crash the command prompt:
Code: Select all
@echo off
set "h=/?"
call rem %%h%%
from command line this can be used - set "h=/?"&call rem %%h%%
Last edited by npocmaka (13 Aug 2015 14:56)