Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Deleting temporary files scripting

  • Filter
  • Time
  • Show
Clear All
new posts

  • Deleting temporary files scripting

    The following startup script deletes temporary files on logon, however, some files are locked, because I started the script up by simply copying the batch file within Start > Startup folder.

    Assuming it is safe to delete temporary files, is there some way of running the script before the files within C:\Documents and Settings\<my user name>\Local Settings\Temp are locked by WinXP SP3 during logon?

    @echo off
    cd %APPDATA%
    cd ..
    cd Local Settings
    cd temp
    del *.* /F /Q > del_temp_files.log

    Are there any other temporary files which you would consider deleting to save on disk space?

    It's noted that del_temp_files.log does not get written to within C:\Documents and Settings\All Users\Start Menu\Programs\Startup, have I used incorrect syntax?

    For example, I was intending to delete uninstall information from C:\WINDOWS, however, I would want to delete folders (e.g. $NTUninstallKB????) that are older than 4 weeks, how can I script this?
    Why would you retain these files? What is your opinion on the safety of retaining uninstall information for fixes?

    I am running Win XP SP3.

    I have been unable to find the Group Policy mentioned within this article, is this because my computer is not part of a domain?
    Last edited by jon80; 26th June 2011, 07:10.

  • #2
    Re: Deleting temporary files scripting

    Your log will be written to the current directory, in this case, the TEMP dir

    You could iterate through all user profiles and delete temp files, but if you want a specific one, you will need to be logged on

    Group Policy applies to domains only.
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    IT Trainer / Consultant
    Ossian Ltd

    ** Remember to give credit where credit is due and leave reputation points where appropriate **