Solved

Logoff script generating a logoff error and not cleaning temp internet files

Posted on 2004-03-26
10
319 Views
Last Modified: 2010-05-01
Hello.  I work in a school district where hundreds of  different users login to workstations hourly.  How can I get rid of the cookies and temp internet files on the local workstation through a logoff script.  I have one created, but keep getting error messages and it is not cleaning the files out.  Here is what I have running on logoff.

SET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files\Content.IE5
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp

FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC3%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC4%\*.*") DO RMDIR  /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC3%\*.*") DO DEL /F /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"

exit

The error is:  Line 1 Char:  12   Error:  Expected Statement    Code:  800A0400  Source:  Microsoft VBScript compilation error.

Any help you can give would be much appreciated.
0
Comment
Question by:manch03
  • 3
  • 2
  • 2
  • +1
10 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 10686823
Hi manch03,
Try changing the first line to
C:\DOCUME~1
and the next three to
LocalS~1
with Tempor~1 (instead of Temporary Internet Files)...
~sirbounty
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 10686934
or try changing to:

SET SRC1=Chr(34) & "C:\Documents and Settings" & Chr(34)
SET SRC2=Chr(34) & "Local Settings\Temporary Internet Files\Content.IE5" & Chr(34)
SET SRC3=Chr(34) & "Local Settings\History" & Chr(34)
SET SRC4=Chr(34) & "Local Settings\Temp" & Chr(34)

0
 

Author Comment

by:manch03
ID: 10688947
Ok - now it does not like:

Line 6, Character 5
Line 1, Character 12

I changed to vinnyd79 comment and ran it.

ET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files\Content.IE5
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp

FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC3%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC4%\*.*") DO RMDIR  /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC3%\*.*") DO DEL /F /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"

exit
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 67

Expert Comment

by:sirbounty
ID: 10689069
Personally, I think you'd be better off creating a batch file here with these command in it...
Either using the 8.3 conversion as I'd displayed or vinnyd79's suggestion of enclosing the LFNs in quotations.
Then have your script simply point to the batch file...
0
 

Author Comment

by:manch03
ID: 10689206
I can just convert this to  batch file?  Are there any commands I need to change?
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 350 total points
ID: 10689321
Just a touch-up.  Haven't tested this, so remove the "echo" if the process routine displays what you need...

SET SRC="%USERPROFILE%\LocalS~1\"
SET SRC1=Tempor~1\Content.IE5
SET SRC2=History
SET SRC3=Temp

FOR /D %%X IN (%SRC%") DO CALL :PROCESS %%X
SET SRC=
SET SRC1=
SET SRC2=
SET SRC3=
GOTO END

:PROCESS
echo RMDIR /S /Q %1\%SRC1%
echo RMDIR /S /Q %1\%SRC2%
echo RMDIR /S /Q %1\%SRC3%
echo DEL /F /S /Q %1\%SRC2%
echo DEL /F /S /Q %1\%SRC4%

:END
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10950265
Restore it to my original form and save as a batch file which it is intended to run as.  
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10950278
Us the changes from the other programmer to add the cookies removal.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question