Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

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

- - - - -

  • Please log in to reply
9 replies to this topic

#1
anoble1

anoble1
  • Member
  • 7 posts
  • OS:XP Pro x86
  • Country: Country Flag
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?


How to remove advertisement from MSFN

#2
vinifera

vinifera

    <°)))><

  • Member
  • PipPipPipPipPip
  • 951 posts
  • OS:Windows 7 x86
  • Country: Country Flag
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, 29 November 2012 - 06:16 PM.

If you want true Windows user experience
try Longhorn builds: 3718, 4029, 4066

#3
5eraph

5eraph

    Update Packrat

  • MSFN Sponsor
  • 1,141 posts
  • OS:XP Pro x64
  • Country: Country Flag

Donator

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

Edited by 5eraph, 29 November 2012 - 06:05 PM.


#4
vinifera

vinifera

    <°)))><

  • Member
  • PipPipPipPipPip
  • 951 posts
  • OS:Windows 7 x86
  • Country: Country Flag
corrected :D
If you want true Windows user experience
try Longhorn builds: 3718, 4029, 4066

#5
anoble1

anoble1
  • Member
  • 7 posts
  • OS:XP Pro x86
  • Country: Country Flag

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,

#6
anoble1

anoble1
  • Member
  • 7 posts
  • OS:XP Pro x86
  • Country: Country Flag
I ran that on my 7 machine and like 10 icons disappeared from my desktop. Not sure what caused that.

#7
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,033 posts
  • OS:none specified
  • Country: Country Flag
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

#8
vinifera

vinifera

    <°)))><

  • Member
  • PipPipPipPipPip
  • 951 posts
  • OS:Windows 7 x86
  • Country: Country Flag
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, 30 November 2012 - 01:32 PM.

If you want true Windows user experience
try Longhorn builds: 3718, 4029, 4066

#9
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,530 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

RD/S/Q "%USERPROFILE%\Documentum\UCF"

RD/S/Q %SYSTEMDRIVE%\Cache\Java

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 10


#10
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,033 posts
  • OS:none specified
  • Country: Country Flag

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN