?
Solved

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

Posted on 2004-03-26
10
Medium Priority
?
330 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
8 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 1400 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

621 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