anoble1 Posted November 29, 2012 Share Posted November 29, 2012 Was wondering if someone could help me Make A Batch File That Deletes FilesNot sure if many can help but I am in IT, and run in to a certain program error all the time. The fix is deleting 4 files in their PC.Example:1.Delete the UCF folder located at C:\Documents and Settings\Username\Documentum2.Delete the Java folder located at C:\Cache3.Delete Temp internet Files - On IE4.Delete Cookies - On IEIn Windows XPAny suggestions? Link to comment Share on other sites More sharing options...
vinifera Posted November 29, 2012 Share Posted November 29, 2012 (edited) noobish atemptnot testedpaths taken from win7echo off:: removes the 2 foldersrd %userprofile%\Documentum\UCFrd %systemdrive%\cache\Java:: ie cachedel /f /q "%userprofile%\appdata\local\Temporary Internet Files" *.*del /f /q "%userprofile%\appdata\local\microsoft\windows\Temporary Internet Files" *.*del /f /q "%systemdrive%\users\default\appdata\local\Temporary Internet Files" *.*del /f /q "%systemdrive%\users\default\appdata\local\microsoft\windows\Temporary Internet Files" *.*del /f /q "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*del /f /q "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*del /f /q "%windir%\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*:: ie cookiesdel /f /q %userprofile%\cookies *.*del /f /q %appdata%\microsoft\windows\cookies *.*del /f /q %systemdrive%\users\default\cookies *.*del /f /q %systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\cookies *.*del /f /q %windir%\ServiceProfiles\LocalService\AppData\Roaming\Microsoft\Windows\cookies *.*del /f /q %windir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\Windows\cookies *.*del /f /q %windir%\System32\config\systemprofile\AppData\Roaming\Microsoft\Windows\cookies *.*exit Edited November 30, 2012 by vinifera Link to comment Share on other sites More sharing options...
Guest Posted November 30, 2012 Share Posted November 30, 2012 (edited) ...except remark lines start with REM or a double colon ( :: ) instead of a semicolon ( ; ). Edited November 30, 2012 by 5eraph Link to comment Share on other sites More sharing options...
vinifera Posted November 30, 2012 Share Posted November 30, 2012 corrected Link to comment Share on other sites More sharing options...
anoble1 Posted November 30, 2012 Author Share Posted November 30, 2012 noobish atemptnot testedpaths taken from win7echo off:: removes the 2 foldersrd %userprofile%\Documentum\UCFrd %systemdrive%\cache\Java:: ie cachedel /f /q "%userprofile%\appdata\local\Temporary Internet Files" *.*del /f /q "%userprofile%\appdata\local\microsoft\windows\Temporary Internet Files" *.*del /f /q "%systemdrive%\users\default\appdata\local\Temporary Internet Files" *.*del /f /q "%systemdrive%\users\default\appdata\local\microsoft\windows\Temporary Internet Files" *.*del /f /q "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*del /f /q "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*del /f /q "%windir%\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*:: ie cookiesdel /f /q %userprofile%\cookies *.*del /f /q %appdata%\microsoft\windows\cookies *.*del /f /q %systemdrive%\users\default\cookies *.*del /f /q %systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\cookies *.*del /f /q %windir%\ServiceProfiles\LocalService\AppData\Roaming\Microsoft\Windows\cookies *.*del /f /q %windir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\Windows\cookies *.*del /f /q %windir%\System32\config\systemprofile\AppData\Roaming\Microsoft\Windows\cookies *.*exitVery nice, will this work on XP and 7? I know some of the directories changedthanks, Link to comment Share on other sites More sharing options...
anoble1 Posted November 30, 2012 Author Share Posted November 30, 2012 I ran that on my 7 machine and like 10 icons disappeared from my desktop. Not sure what caused that. Link to comment Share on other sites More sharing options...
jaclaz Posted November 30, 2012 Share Posted November 30, 2012 Well, IMHO the chances of the posted batch to work on any of the two systems are pretty dim anyway, and the BAD news are that is potentially HIGHLY destructive .What happens if the directories are not empty?A /s parameter may be of use:http://ss64.com/nt/rd.htmlAnd I do have some BIG perplexities on the PATHs/filenames given to the del command:http://ss64.com/nt/del.htmlI would try with something like:del /f /q "%userprofile%\appdata\local\Temporary Internet Files\ *"i.e. with the full path inside the quotes and a single asterisk, but as a matter of fact if you try on a command line:md C:\mytestmd C:\mytest\mytestsubecho test1>C:\mytest\mytestsub\mytest1.txtecho test2>C:\mytest\mytestsub\mytest2.txtecho test3>C:\mytest\mytest3.txtdel "C:\mytest"you will see how you will be prompted with something like:C:\mytest\*, Proceed (Y/N)?(press N to the prompt).Now try issuing:CD /D C:\mytestdel "C:\mytest\mytestsub" *.*You are now prompted with:C:\mytest\mytestsub\*, Proceed (Y/N)?this time press Y to the prompt, you will be immediately prompted:C:\mytest\*.*, Proceed (Y/N)?del accepts a LIST of files to be deleted, a line like this:del /f /q "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\Temporary Internet Files" *.*will quietly delete all files in "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\Temporary Internet Files" and then delete ALL FILES in CURRENT DIRECTORY .jaclaz Link to comment Share on other sites More sharing options...
vinifera Posted November 30, 2012 Share Posted November 30, 2012 (edited) I wrote its untestedtherefore I don't claim it would work or what it will do to a system ccleaner is better to use Edited November 30, 2012 by vinifera Link to comment Share on other sites More sharing options...
Yzöwl Posted November 30, 2012 Share Posted November 30, 2012 RD/S/Q "%USERPROFILE%\Documentum\UCF"RD/S/Q %SYSTEMDRIVE%\Cache\JavaRunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 10 Link to comment Share on other sites More sharing options...
jaclaz Posted December 1, 2012 Share Posted December 1, 2012 I wrote its untestedtherefore I don't claim it would work or what it will do to a system Well, with all due respect , you should NOT post - and expecially in response to someone evidently not famiiar with the command line or batches - an untested script with such a potential destructive power.You do understand that if the user would have run that crappy batch in System directory or in Root he would likely have made the system unbootable/unrecoverable, do you? jaclaz 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