How can I automatically delete the contents of the users' temp folders? - Windows NT

This is a discussion on How can I automatically delete the contents of the users' temp folders? - Windows NT ; How can I automatically delete the contents of the users' temp folders with the login script. The server is Windows 2000 with an AD and Win 2000 and XP PCs. So far I have worked out echo y | del ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: How can I automatically delete the contents of the users' temp folders?

  1. How can I automatically delete the contents of the users' temp folders?

    How can I automatically delete the contents of the users' temp folders
    with the login script. The server is Windows 2000 with an AD and Win
    2000 and XP PCs.

    So far I have worked out
    echo y | del %systemdrive%\"Documents and Settings"\%username%\temp*.*
    but this doesn't include the switch for the local settings folder and
    if I try and add it, the command fails.

    Help!

    Thanks

    Alex


  2. Re: How can I automatically delete the contents of the users' temp folders?


    "alexharris@aol.comNEWS" wrote in message
    news:1112023325.631509.324750@z14g2000cwz.googlegr oups.com...
    > How can I automatically delete the contents of the users' temp folders
    > with the login script. The server is Windows 2000 with an AD and Win
    > 2000 and XP PCs.
    >
    > So far I have worked out
    > echo y | del %systemdrive%\"Documents and Settings"\%username%\temp*.*
    > but this doesn't include the switch for the local settings folder and
    > if I try and add it, the command fails.
    >
    > Help!
    >
    > Thanks
    >
    > Alex
    >


    A more elegeant method goes like this:

    del /q "%temp%\*.tmp"

    What exactly do you mean with "include the switch for the local
    settings folder"? Maybe something like this?

    del /q /s "%UserProfile%\*.tmp"



  3. Re: How can I automatically delete the contents of the users' temp folders?

    Or U could always try something like power tweak 2005 or windows washer.


  4. Re: How can I automatically delete the contents of the users' temp folders?

    "alexharris@aol.comNEWS" wrote in
    news:1112023325.631509.324750@z14g2000cwz.googlegr oups.com:

    > Path:
    > tabloid.srv.ualberta.ca!cyclone.bc.net!newshub.sds u.edu!postnews.google
    > .com!z14g2000cwz.googlegroups.com!not-for-mail From:
    > "alexharris@aol.comNEWS" Newsgroups:
    > comp.os.ms-windows.nt.misc Subject: How can I automatically delete the
    > contents of the users' temp folders? Date: 28 Mar 2005 07:22:05 -0800
    > Organization: http://groups.google.com
    > Lines: 15
    > Message-ID: <1112023325.631509.324750@z14g2000cwz.googlegroups. com>
    > NNTP-Posting-Host: 217.155.167.121
    > Mime-Version: 1.0
    > Content-Type: text/plain; charset="iso-8859-1"
    > X-Trace: posting.google.com 1112023330 2897 127.0.0.1 (28 Mar 2005
    > 15:22:10 GMT) X-Complaints-To: groups-abuse@google.com
    > NNTP-Posting-Date: Mon, 28 Mar 2005 15:22:10 +0000 (UTC)
    > User-Agent: G2/0.2
    > Complaints-To: groups-abuse@google.com
    > Injection-Info: z14g2000cwz.googlegroups.com;
    > posting-host=217.155.167.121;
    > posting-account=RNAPZg0AAAAjG5KjUaYmbSicgGFm9ILt
    > Xref: tabloid.srv.ualberta.ca comp.os.ms-windows.nt.misc:330023
    >
    > How can I automatically delete the contents of the users' temp folders
    > with the login script. The server is Windows 2000 with an AD and Win
    > 2000 and XP PCs.
    >
    > So far I have worked out
    > echo y | del %systemdrive%\"Documents and Settings"\%username%\temp*.*
    > but this doesn't include the switch for the local settings folder and
    > if I try and add it, the command fails.
    >
    > Help!
    >
    > Thanks
    >
    > Alex
    >
    >


    Below is the batch file I usually use for this:

    @echo off
    if "%temp%"=="" goto :eof
    if exist %temp%\donotdelete.me goto :eof
    rd/s/q %temp% 2>%temp%\delete.me
    del %temp%\delete.me

    Using the %temp% ensures that it gets the correct temp directory, in case
    it has been set to be somewhere else - if environment variable TEMP is not
    set, it quits.

    The check for donotdelete.me allows you to put a file named that in there
    to keep it from deleting anything in the temp directory - useful if you
    install something that puts things in temp to be executed on next startup.

    The rd/s/q removes everything, including subdirs, from the temp directory
    (the redirection of stderr to delete.me keeps it from removing the
    directory itself by creating the file delete.me which is held open - this
    file is then deleted by the next line).

    I usually call this in the LOGOFF script, not the LOGON one.


+ Reply to Thread