Scripting Question

Delete AppData Temp files

05/31/2018 856 views


I'm looking to create a batch that would clean the AppData Local Temp folder on all user profiles at a specific time.

Would this be the proper command for it to start off?

DEL C:\%Users%\AppData\Local\Temp

Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author

I would do it this way, with a BAT file, Just change the path, the %USERNAME%, should grab all users.
The variable TargetDir will contain whatever path you specify.
rd deletes a directory. This command is the same as the rmdir command.
/s  deletes a directory tree (the specified directory and all its sub-directories, including all files)
/q Specifies quiet mode. Does not prompt for confirmation when deleting a directory tree.
@echo off
set TargetDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data
rd /s /q "%TargetDir%"

Save that as a BAT file, and you can use it with any tool such as SCCM or KACE.

Answered 05/31/2018 by: Channeler
Red Belt

All Answers

I have used this ahk script ages ago and it worked fine for me. The problem is the fact that you are wanting to cleanup every user on the machine. You will have to first gather a master list. The script would need be updated to be modernized, take out the XP centric stuff. Well it wouldn't format the code correctly for some reason, so I removed it.
Answered 06/01/2018 by: five.
Second Degree Green Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ