Worf Posted January 31, 2008 Share Posted January 31, 2008 Hi.Any one know how to delete directories after windows is installed from a batch file? I have searched but have not found anything 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 More sharing options...
Arie Posted January 31, 2008 Share Posted January 31, 2008 Here's an excerpt from my one of my own scripts.REM DELETE SHORTCUTSDEL /F /Q "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk">NULDEL /F /Q "%AllUsersProfile%\Start Menu\Windows Catalog.lnk">NULDEL /F /Q "%AllUsersProfile%\Start Menu\Windows Update.lnk">NULDEL /F /Q "%UserProfile%\Start Menu\Programs\Accessories\Tour Windows XP.lnk">NULREM DELETE FOLDERSRD /S /Q "%AllUsersProfile%\Start Menu\Programs\Powertoys for Windows XP">NULRD /S /Q "%UserProfile%\Start Menu\Programs\Powertoys for Windows XP">NULRD /S /Q "%ProgramFiles%\Common Files\Services">NULRD /S /Q "%ProgramFiles%\Online Services">NULRD /S /Q "%SystemRoot%\$Nt*$">NULRD /S /Q "%SystemRoot%\setup.pss">NULREM DELETE SAMPLE CONTENTDEL /F /S /Q "%UserProfile%\My Documents\My Music">NULDEL /F /S /Q "%UserProfile%\My Documents\My Pictures">NULDEL /F /S /Q "%UserProfile%\My Documents\My Videos">NULREM DELETE FAVORITESDEL /F /S /Q "%SystemDrive%\Documents and Settings\Default User\Favorites">NULDEL /F /S /Q "%UserProfile%\Favorites">NULREM DELETE FILESDEL /F /S /Q "%SystemDrive%\clock.avi">NULDEL /F /S /Q "%SystemDrive%\swtchbrd.bmp">NULDEL /F /S /Q "%SystemDrive%\yahoo.bmp">NULREM DELETE TEMPORARY FILESDEL /F /S /Q %SystemDrive%\~*.*>NULDEL /F /S /Q %SystemDrive%\*.~~~>NULDEL /F /S /Q %SystemDrive%\*.~m~>NULDEL /F /S /Q %SystemDrive%\*.###>NULDEL /F /S /Q %SystemDrive%\*.$$$>NULDEL /F /S /Q %SystemDrive%\*.--->NULDEL /F /S /Q %SystemDrive%\*._mp>NULDEL /F /S /Q %SystemDrive%\*.bk!>NULDEL /F /S /Q %SystemDrive%\*.tmp>NULDEL /F /S /Q %SystemRoot%\*.bak>NULDEL /F /S /Q %SystemRoot%\*.log>NULDEL /F /S /Q %SystemRoot%\TEMP>NULHope this gives you good start Link to comment Share on other sites More sharing options...
Worf Posted February 1, 2008 Author Share Posted February 1, 2008 Thanks Arie Sure does gives me a good start, will try them out. Link to comment Share on other sites More sharing options...
bledd Posted February 1, 2008 Share Posted February 1, 2008 (edited) rd /S /Q "C:\folder"that deletes them, the /S is for removing them even if they have data/subfolders in themthis website is handy http://www.ss64.com/nt/index.html Edited February 1, 2008 by bledd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now