#38788 - 2003-04-04 01:29 PM
Delete a directory
|
miller9
Fresh Scripter
Registered: 2002-12-30
Posts: 7
|
i trying to delete the contents of all c:\windows\Temporary Internet Files\
searched around thru the board but dont seem to be able find a soloution that works?
anyone give me some help?
|
|
Top
|
|
|
|
#38791 - 2003-04-04 03:24 PM
Re: Delete a directory
|
AzzerShaw
Seasoned Scripter
  
Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
|
This maybe over complicating it a bit but the below could be run if you had a list of pc's that you need the contents deleting on, it may need tweaking a bit but it gives you a general idea..good luck )
Break on Open (1,"drive:\pclist.txt") Open (2,"drive:\\Success.txt",5) Open (3,"drive:\fail.txt",5)
WriteLine(2,"---Script Started: @date at @time---"+Chr(13)+Chr(10))
Do $CompName=ReadLine(1)
If $CompName<>"" Use "$CompName\c$" If @error = 0 Sleep 1 If Exist("$CompName\c$\windows\Temporary Internet Files\")=1 Del "c:\windows\Temporary Internet Files\" Else WriteLine(2,"No temp files found $CompName"+Chr(13)+Chr(10)) WriteLine(3,"$CompName"+Chr(13)+Chr(10)) EndIf Use "$CompName\C$" /delete Sleep 2 Else WriteLine(2," # Failed, $CompName was not available"+Chr(13)+Chr(10)) WriteLine(3,"$CompName"+Chr(13)+Chr(10)) EndIf Else EndIf
Until $CompName=""
WriteLine(2,"---Script Finished: @date at @time---"+Chr(13)+Chr(10))
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields
|
|
Top
|
|
|
|
#38793 - 2003-04-04 03:34 PM
Re: Delete a directory
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Provided the user has Power User rights or better logging in..
code:
CLS BREAK ON $REGKEY='HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache'
IF '00000000' <> READVALUE($REGKEY,'Persistent') $RC=WRITEVALUE($REGKEY,'Persistent','00000000','REG_BINARY') ENDIF
HTH,
Kent [ 04. April 2003, 15:47: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#38795 - 2003-04-04 03:46 PM
Re: Delete a directory
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
The Reg key used in the script was determined using the RegShot Util in the Registry tools list from the FAQ Forum.
It is using the built-in functionality of Internet Explorer where you tell IE to delete the Temporary Internet Files on close of IE.
{Edit} Just verified at - http://www.winguides.com/registry/display.php/1173/ Made the modification too. {/Edit}
Kent [ 04. April 2003, 15:49: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#38797 - 2003-04-04 04:03 PM
Re: Delete a directory
|
miller9
Fresh Scripter
Registered: 2002-12-30
Posts: 7
|
thanx for all the replies.. i want the contents of the folder cleared each time a user logs on, work in a school and want the folder cleared everytime a new users logs on is there not some sort of del command that i can use?
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1077 anonymous users online.
|
|
|