0
Thanks

A few words of thanks would be greatly appreciated.

A batch file to delete temp user files

A Windows batch file is a type of text file, which contains a series of commands for a computer's operating system. You should not open batch files on your hard disk that are unknown as they contain executable commands. The file extension for batch file is .BAT. The Temp files (Temporary files) are created by system programs essentially when the programs cannot get the appropriate level of memory to complete a task. Using batch files you can view, access and erase the content of the temporary files as you would do in the Command prompt by typing a specific set of commands.


Issue


I'm trying to create a batch file to clean my business PC (such as the contents of Temp files and Temporary Internet Files for each user...)

Solution


This script deletes all files in
  • C:\Documents And Settings\<UserName>\Local settings\Temp and
  • C:\Documents And Settings\<UserName>\Local settings\Temporary Internet Files

@echo off   
cd /d %temp%   
for /r %%a in (*.*) do (   
del /f /q %~a   
) >nul   
cd /d "%UserProfile%\Local Settings\Temporary Internet Files   
for /r %%b in (*.*) do (   
del /f /q %~b   
) >nul   


Thanks to theo7777 for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Published by . Latest update on by Virginia Parsons.

This document, titled "A batch file to delete temp user files," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments