Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-03-26
10
Medium Priority
?
327 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
Industry Leaders: 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

916 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