Was wondering if someone could help me Make A Batch File That Deletes
#1
Posted 29 November 2012 - 02:13 PM
Not 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\Documentum
2.Delete the Java folder located at C:\Cache
3.Delete Temp internet Files - On IE
4.Delete Cookies - On IE
In Windows XP
Any suggestions?
#2
Posted 29 November 2012 - 03:03 PM
not tested
paths taken from win7
echo off :: removes the 2 folders rd %userprofile%\Documentum\UCF rd %systemdrive%\cache\Java :: ie cache del /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 cookies del /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
This post has been edited by vinifera: 29 November 2012 - 06:16 PM
#3
Posted 29 November 2012 - 06:05 PM
This post has been edited by 5eraph: 29 November 2012 - 06:05 PM
#5
Posted 30 November 2012 - 12:26 PM
vinifera, on 29 November 2012 - 03:03 PM, said:
not tested
paths taken from win7
echo off :: removes the 2 folders rd %userprofile%\Documentum\UCF rd %systemdrive%\cache\Java :: ie cache del /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 cookies del /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
Very nice, will this work on XP and 7? I know some of the directories changed
thanks,
#6
Posted 30 November 2012 - 12:49 PM
#7
Posted 30 November 2012 - 01:00 PM
What happens if the directories are not empty?
A /s parameter may be of use:
http://ss64.com/nt/rd.html
And I do have some BIG perplexities
http://ss64.com/nt/del.html
I would try with something like:
Quote
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:\mytest md C:\mytest\mytestsub echo test1>C:\mytest\mytestsub\mytest1.txt echo test2>C:\mytest\mytestsub\mytest2.txt echo test3>C:\mytest\mytest3.txt del "C:\mytest"
you will see how you will be prompted with something like:
Quote
(press N to the prompt).
Now try issuing:
CD /D C:\mytest del "C:\mytest\mytestsub" *.*
You are now prompted with:
Quote
this time press Y to the prompt, you will be immediately prompted:
Quote
del accepts a LIST of files to be deleted, a line like this:
Quote
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
#8
Posted 30 November 2012 - 01:31 PM
therefore I don't claim it would work or what it will do to a system
ccleaner is better to use
This post has been edited by vinifera: 30 November 2012 - 01:32 PM
#9
Posted 30 November 2012 - 01:55 PM
RD/S/Q "%USERPROFILE%\Documentum\UCF" RD/S/Q %SYSTEMDRIVE%\Cache\Java RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 10
#10
Posted 01 December 2012 - 05:02 AM
vinifera, on 30 November 2012 - 01:31 PM, said:
therefore I don't claim it would work or what it will do to a system
Well, with all due respect
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
- ← Path too long and devcon
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- bat2exe not work win x64? →



Help
Back to top









