I created the following .bat file to clear the prefetch and temp folders of Windows 10:
cd %systemroot%\Prefetch
del /q /s *.*
cd %temp%
del /q /s *.*
Now, on my system, running the file did exactly what it's supposed to, no matter from where I executed it. However, on a different system (also Win10), executing the script from the desktop deleted the contents of everything in the desktop folder (C:\Users\\Desktop).
Right now I'm completely clueless how this is possible. I would be thankful for any explanations. Also, I assume there's no efficient way to restore the data deleted that way?
Thank you.
EDIT: I realize that running the script from the Desktop when the first folder doesn't exist calls the delete on the desktop directory, however the folders do exist.
del /q /s %systemroot%\Prefetch\*.*
and maybe adding some conditional logic to ensure thecd
is set in the right folder before thedel
command. – Pimp Juice IT Feb 10 at 17:09