MSFN Forum: Deleting directories after install - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Deleting directories after install Rate Topic: -----

#1 User is offline   Worf 

  • Worf
  • PipPip
  • Group: Members
  • Posts: 187
  • Joined: 26-October 04

Posted 31 January 2008 - 02:11 PM

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


#2 User is offline   Arie 

  • One Man Army
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 27-August 07

Posted 31 January 2008 - 03:45 PM

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 :)

#3 User is offline   Worf 

  • Worf
  • PipPip
  • Group: Members
  • Posts: 187
  • Joined: 26-October 04

Posted 01 February 2008 - 12:01 AM

Thanks Arie Sure does gives me a good start, will try them out.

#4 User is offline   bledd 

  • msfn is a friend of mine!
  • Group: Supreme Sponsor
  • Posts: 1,732
  • Joined: 24-March 04

Posted 01 February 2008 - 12:03 AM

rd /S /Q "C:\folder"

that deletes them, the /S is for removing them even if they have data/subfolders in them

this website is handy :) http://www.ss64.com/nt/index.html

This post has been edited by bledd: 01 February 2008 - 12:04 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy