looking for a way to perform the following:
Start > Run > "%TEMP% > Delete everything (skipping any conflicts).
so Far I have
@echo off
start %TEMP%
DEL *.*
I suppose I could use CD to get to the folder, the thing I'm wondering is if there are any instances where it cannot delete an a dialog box comes up, I want to skip these.
Thanks for the help! Liam
Press Start, type Run, and press Enter . In the Run window, type shell:startup to open the Startup folder. Once the Startup folder is opened, click the Home tab at the top of the folder. Then, select Paste to paste the shortcut file into the Startup folder.
When used in a command line, script, or batch file, %1 is used to represent a variable or matched string. For example, in a Microsoft batch file, %1 can print what is entered after the batch file name.
The following batch commands are used to delete all your temp, recent and prefetch files on your System.
Save the following code as "Clear.bat" on your local system
*********START CODE************
@ECHO OFF
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q C:\Windows\Prefetch\*.*
del /s /f /q C:\Windows\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
/Below command to Show the folder after deleted files
Explorer %userprofile%\Recent
Explorer C:\Windows\Prefetch
Explorer C:\Windows\Temp
Explorer %USERPROFILE%\appdata\local\temp
*********END CODE************
del
won't trigger any dialogs or message boxes. You have a few problems, though:
start
will just open Explorer which would be useless. You need cd
to change the working directory of your batch file (the /D
is there so it also works when run from a different drive):
cd /D %temp%
You may want to delete directories as well:
for /d %%D in (*) do rd /s /q "%%D"
You need to skip the question for del
and remove read-only files too:
del /f /q *
so you arrive at:
@echo off
cd /D %temp%
for /d %%D in (*) do rd /s /q "%%D"
del /f /q *
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With