Batch File

Discussion in 'Scripting & Programming' started by Mr.Cheeks, Mar 16, 2007.

  1. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
    Question:

    Can a batch file me used to clean up temporary internet files, cookies and crap remotely?

    The batch files needs to prompt for a computer name, then go to doc and settings and then prompt for username and then clear the files and tell you that all is done and then confirm to close program.

    I ask this becuase at work, everyone should (doesn't have to) come up with a presentation of somesort (IT Work related) that is useful to the team...

    Cheers. btw: im sure that the the prompts can be done, im just unsure whether it can delete the stuff as index.dat cannot be deleted....

    Thanks
     
  2. garyb

    garyb Byte Poster

    179
    2
    22
    Possible, but GPO can do the job better..

    User Configuration ->
    Administrative Templates ->
    Windows Components ->
    Internet Explorer ->
    Internet Control Panel ->
    Advanced Page

    From the policy setting:

    This policy setting allows you to manage whether Internet Explorer deletes the contents of the Temporary Internet Files folder after all browser windows are closed. This protects against storing dangerous files on the computer, or storing sensitive files that other users could see, in addition to managing total disk space usage.

    If you enable this policy setting, Internet Explorer will delete the contents of the user's Temporary Internet Files folder when all browser windows are closed.

    G
     
    WIP: MCSA 2003
  3. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
    i understand tath, but im assuming the the policy has not been enabled, that why i want to see if a batch file can do this... like mentioned before, each person should create something it worked related thats useful for the colleagues. i was thinking of a batch file cleaning the temp folders remotely... just need now to figure it out.
     
  4. nugget
    Honorary Member

    nugget Junior toady

    7,796
    71
    224
    What you could do instead of trying to do it remotely is configure it as a logon script. I did have something like this that I used for the same purpose of deleting all the cookies at startup, including index.dat. I'll see if I can find it for you.
     
    Certifications: A+ | Network+ | Security+ | MCP (270,271,272,290,620) | MCDST | MCTS:Vista
    WIP: MCSA, 70-622,680,685
  5. Sparky
    Highly Decorated Member Award 500 Likes Award

    Sparky Zettabyte Poster Moderator

    10,718
    543
    364
    As posted the best way to do this is with group policy.

    Also if you delete cookies it may cause problems, is it really worth the trouble? :blink
     
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) MS-900 AZ-900 Security+ Network+ A+
    WIP: Microsoft Certs
  6. Bluerinse
    Honorary Member

    Bluerinse Exabyte Poster

    8,878
    181
    256
    The truth is, the temporary Internet files and cookies are not crap, they are there for a purpose. The temporary Internet files are the browsers cache, these files help speed up the users browsing experience and help reduce bandwidth - the cookies store among other things user preferences and automatic log-in info. If you randomly delete these, some users may complain.
     
    Certifications: C&G Electronics - MCSA (W2K) MCSE (W2K)
  7. BosonMichael
    Honorary Member Highly Decorated Member Award 500 Likes Award

    BosonMichael Yottabyte Poster

    19,183
    500
    414
    I know I would. Logging in each time is a complete pain.
     
    Certifications: CISSP, MCSE+I, MCSE: Security, MCSE: Messaging, MCDST, MCDBA, MCTS, OCP, CCNP, CCDP, CCNA Security, CCNA Voice, CNE, SCSA, Security+, Linux+, Server+, Network+, A+
    WIP: Just about everything!
  8. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
    Yes please

    ok, sorry for the confusion guys...
    the reason why i chosen to create a batch file to delete the temp files is becuase, when a user recieves a certain error with a certain application, we already know what to do
    the solution is to delete the temp internet files on the user's account, strangely, right clicking IE and and deleting cookies and temp files way doesn't work, not too sure why though.
    what we have to do is click on start> run >\\pcname\c$ go through doc & settings, look for the account, and manually deleting data this way.

    another note is that, all users have access to the intranet, but a very few have access to the internet.

    Does this clarify the matter?
     
  9. Sparky
    Highly Decorated Member Award 500 Likes Award

    Sparky Zettabyte Poster Moderator

    10,718
    543
    364
    This *should* do it. You will need to tweak the line which looks for the path to the directory you want to delete. Copy the code into a txt file and save as a .vbs file and test.

    Code:
    dim filesys, demofolder, computername, fullpath, userprofile
    
    computername = InputBox("Please enter computer name")
    userprofile = InputBox("Please enter the user profile name")
    
    fullpath = "\\" & computername & "\c$\Documents and Settings\" & userprofile & "\ Put the directory you want to delete here"
    
    
    set filesys = CreateObject ("Scripting.FileSystemObject")
    set demofolder = filesys.GetFolder(fullpath)
    demofolder.Delete
    
    
     
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) MS-900 AZ-900 Security+ Network+ A+
    WIP: Microsoft Certs
  10. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
    cheers mate - i'll have a play at work...
     
  11. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
    Question:

    ping clown.com > clown.txt
    this saves the output to a txt file

    but is there a way to do a ping and tracert to clown.com and save both results to one .txt file?

    and also for it to prompt for an ip address aswell? it has to be a batch file, as vbscripting has been denied for the tier1 kids... (found it - eventtriggers)
     
  12. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
    Question:

    Does anyone know whether a prompt function can be made in dos??? e.g prompts for an IP address and then continues with the commands?
     
  13. Bluerinse
    Honorary Member

    Bluerinse Exabyte Poster

    8,878
    181
    256
    Certifications: C&G Electronics - MCSA (W2K) MCSE (W2K)
  14. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,373
    89
    190
  15. Sparky
    Highly Decorated Member Award 500 Likes Award

    Sparky Zettabyte Poster Moderator

    10,718
    543
    364
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) MS-900 AZ-900 Security+ Network+ A+
    WIP: Microsoft Certs

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.