Jump to content

Deleting directories after install


Recommended Posts

Hi.

Any one know how to delete directories after windows is installed from a batch file? I have searched but have not found anything :no:

Some of the directories i want to delete are from some silent application installs which has left some directories, most of them have '.tmp' at the end so i would like to be able to search for directories like these and then delete them.

Many Thanks for any help.

Worf

Link to comment
Share on other sites


Here's an excerpt from my one of my own scripts.

REM DELETE SHORTCUTS
DEL /F /Q "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk">NUL
DEL /F /Q "%AllUsersProfile%\Start Menu\Windows Catalog.lnk">NUL
DEL /F /Q "%AllUsersProfile%\Start Menu\Windows Update.lnk">NUL
DEL /F /Q "%UserProfile%\Start Menu\Programs\Accessories\Tour Windows XP.lnk">NUL

REM DELETE FOLDERS
RD /S /Q "%AllUsersProfile%\Start Menu\Programs\Powertoys for Windows XP">NUL
RD /S /Q "%UserProfile%\Start Menu\Programs\Powertoys for Windows XP">NUL
RD /S /Q "%ProgramFiles%\Common Files\Services">NUL
RD /S /Q "%ProgramFiles%\Online Services">NUL
RD /S /Q "%SystemRoot%\$Nt*$">NUL
RD /S /Q "%SystemRoot%\setup.pss">NUL

REM DELETE SAMPLE CONTENT
DEL /F /S /Q "%UserProfile%\My Documents\My Music">NUL
DEL /F /S /Q "%UserProfile%\My Documents\My Pictures">NUL
DEL /F /S /Q "%UserProfile%\My Documents\My Videos">NUL

REM DELETE FAVORITES
DEL /F /S /Q "%SystemDrive%\Documents and Settings\Default User\Favorites">NUL
DEL /F /S /Q "%UserProfile%\Favorites">NUL

REM DELETE FILES
DEL /F /S /Q "%SystemDrive%\clock.avi">NUL
DEL /F /S /Q "%SystemDrive%\swtchbrd.bmp">NUL
DEL /F /S /Q "%SystemDrive%\yahoo.bmp">NUL

REM DELETE TEMPORARY FILES
DEL /F /S /Q %SystemDrive%\~*.*>NUL
DEL /F /S /Q %SystemDrive%\*.~~~>NUL
DEL /F /S /Q %SystemDrive%\*.~m~>NUL
DEL /F /S /Q %SystemDrive%\*.###>NUL
DEL /F /S /Q %SystemDrive%\*.$$$>NUL
DEL /F /S /Q %SystemDrive%\*.--->NUL
DEL /F /S /Q %SystemDrive%\*._mp>NUL
DEL /F /S /Q %SystemDrive%\*.bk!>NUL
DEL /F /S /Q %SystemDrive%\*.tmp>NUL
DEL /F /S /Q %SystemRoot%\*.bak>NUL
DEL /F /S /Q %SystemRoot%\*.log>NUL
DEL /F /S /Q %SystemRoot%\TEMP>NUL

Hope this gives you good start :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...