Results 1 to 7 of 7

Thread: Trying to automate something...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Location
    Seattle
    Posts
    3
    Thanks
    0
    Thanked
    0 times in 0 posts

    Trying to automate something...

    Hi everyone,

    I must say this looks like a very nice community to spend time in, I haven't seen one flame or troll in all the messages!

    I do a ton of virus scanning on the test machines at my tech shop. I generally keep the AV on my test machine extremely up to date, connect foreign hard drives to it and remove virii in that way, but the temp and temporary internet files on most of my end users machines will generally kill an extra hour of scan time if I don't manually go in and remove them.

    I'm trying to figure out a way for a script of some kind to go into each user under the Documents and Settings folder and remove the temp and temporary internet files folders prior to scanning. Windows has a few automatic users there all the time such as All Users, Administrator, LocalService, etc. My question is, Is there a way to have a system variable or something that can remove those temp folders out of the Local settings folder?

    Or perhaps a cmd line command to remove dir anything with temp recursively or something?

    Is there a system variable that stands for "I dont care what it is, but if it has "temp" in it I want it gone!" ?

    Any suggestions are welcomed, thanks!
    Last edited by sabot77; 25-10-2005 at 07:59 AM.

  2. #2
    Registered User
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked
    2 times in 2 posts
    You could try something like autoit to automate frequent stuf that you do -

    http://www.autoitscript.com/autoit3/index.php

    There is a yahoo group for autoit - http://groups.yahoo.com/group/AutoItList/

    If you register there you can donwload a program that will record what you do and then you can use this with autoit to make an exe file for you.

  3. #3
    Treasure Hunter extraordinaire herulach's Avatar
    Join Date
    Apr 2005
    Location
    Bolton
    Posts
    5,618
    Thanks
    18
    Thanked
    172 times in 159 posts
    • herulach's system
      • Motherboard:
      • MSI Z97 MPower
      • CPU:
      • i7 4790K
      • Memory:
      • 8GB Vengeance LP
      • Storage:
      • 1TB WD Blue + 250GB 840 EVo
      • Graphics card(s):
      • 2* Palit GTX 970 Jetstream
      • PSU:
      • EVGA Supernova G2 850W
      • Case:
      • CM HAF Stacker 935, 2*360 Rad WC Loop w/EK blocks.
      • Operating System:
      • Windows 8.1
      • Monitor(s):
      • Crossover 290HD & LG L1980Q
      • Internet:
      • 120mb Virgin Media
    Are they stored in the same place or are there individual local user names? if its the former you want to look into something like deltree "insert path to temp files here" in a .bat file.
    If not then you might want to lok at the new shell for windows, msh which is pretty sweet and you could do what you want with no trouble.

  4. #4
    Member
    Join Date
    Sep 2003
    Posts
    95
    Thanks
    0
    Thanked
    1 time in 1 post
    You can also do it with the for command in a batch file.

    Basically use the for comand to cycle through all of the users available underneath Documents and settings.

    you'll need to use the dos type 7.23 names, you can access these with a dir /X at the command prompt. Documents and Settings will be: DOCUME~1



    ty

  5. #5
    Senior Member chrestomanci's Avatar
    Join Date
    Sep 2004
    Location
    Reading
    Posts
    1,614
    Thanks
    94
    Thanked
    96 times in 80 posts
    • chrestomanci's system
      • Motherboard:
      • Asus AMD AM4 Ryzen PRIME B350M
      • CPU:
      • AMD Ryzen 1600 @ stock clocks
      • Memory:
      • 16Gb DDR4 2666MHz
      • Storage:
      • 250Gb Samsung 960 Evo M.2 + 3Tb Western Digital Red
      • Graphics card(s):
      • Basic AMD GPU (OSS linux drivers)
      • PSU:
      • Novatech 500W
      • Case:
      • Silverstone Sugo SG02
      • Operating System:
      • Linux - Latest Xubuntu
      • Monitor(s):
      • BenQ 24" LCD (Thanks: DDY)
      • Internet:
      • Zen FTTC
    I would stick perl on the test machine, and then write a simple script to find all the directories to clear out.

    You could also use cygwin, as it's shell suppords wild card expansion, then you can type something like:
    Code:
    rm -rf /cygdrive/e/Documents\ and\ Settings/*/Local\ Settings/Temporary\ Internet\ Files/
    Where 'e' is the drive letter of the user's HD you have just connected.

  6. #6
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    i would use MSH rather than perl, purely because perl in a security context makes me shudder. Even thou it shouldn't matter at all in this case, it makes me shudder.
    throw new ArgumentException (String, String, Exception)

  7. #7
    Member
    Join Date
    Oct 2005
    Location
    Devon
    Posts
    57
    Thanks
    0
    Thanked
    0 times in 0 posts
    Here's a batch file that should do what you want:

    Code:
    @ECHO OFF
    FOR /D %%A IN ("z:\Documents and Settings\*") DO (
      IF EXIST "%%A\Local Settings\Temp" (
        RD /S "%%A\Local Settings\Temp"
        MD "%%A\Local Settings\Temp"
      )
      IF EXIST "%%A\Local Settings\Temporary Internet Files" (
        RD /S "%%A\Local Settings\Temporary Internet Files"
        MD "%%A\Local Settings\Temporary Internet Files"
      )
    )
    pause
    Just change the z: to the letter of the attached drive then save is as a .BAT file.

    It basically loops through all folders in the Documents and Settings folder and deletes then recreates the 'Temp' and 'Temporary Internet Files' folders. For saftey reasons it prompts you before deleting each folder.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •