Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



Sign in to follow this  
anoble1

Was wondering if someone could help me Make A Batch File That Deletes

Recommended Posts

anoble1    0

Was wondering if someone could help me Make A Batch File That Deletes Files

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?

Share this post


Link to post
Share on other sites

vinifera    98

noobish atempt

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

Edited by vinifera

Share this post


Link to post
Share on other sites
Guest   
Guest

...except remark lines start with REM or a double colon ( :: ) instead of a semicolon ( ; ). ;)

Edited by 5eraph

Share this post


Link to post
Share on other sites
anoble1    0

noobish atempt

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,

Share this post


Link to post
Share on other sites
jaclaz    943

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.html

And I do have some BIG perplexities :unsure: on the PATHs/filenames given to the del command:

http://ss64.com/nt/del.html

I 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:\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:

C:\mytest\*, Proceed (Y/N)?

(press N to the prompt).

Now try issuing:

CD /D C:\mytest
del "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 :w00t::ph34r: .

jaclaz

Share this post


Link to post
Share on other sites
vinifera    98

I wrote its untested

therefore I don't claim it would work or what it will do to a system :P

ccleaner is better to use

Edited by vinifera

Share this post


Link to post
Share on other sites
Yzöwl    30
RD/S/Q "%USERPROFILE%\Documentum\UCF"
RD/S/Q %SYSTEMDRIVE%\Cache\Java
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 10

Share this post


Link to post
Share on other sites
jaclaz    943

I wrote its untested

therefore I don't claim it would work or what it will do to a system :P

Well, with all due respect :), you should NOT post :realmad: - 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? :unsure:

jaclaz

Share this post


Link to post
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

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×