Results 1 to 10 of 10

Thread: How To Write Batch File

  1. #1
    100%'s Avatar ╚════╩═╬════╝
    Join Date
    Jan 2003
    Posts
    13,383
    I recently discovered the basics of making a batch file, thru a tweak for automating deletion of the prefetch.
    I know there are tons of progs for cleaning web history + IE has it in its options, but i would like to learn to make one in batch mode.
    I have found alot of info in google which i am going through.
    This is the begining for me.

    1.Whats the difference between these two?
    Deleting the prefetch :
    a: del C:\Windows\Prefetch\*.*

    In Temp folder it doesnt work, instead i have to write :
    b. cd C:\Documents and Settings\XXX\Local Settings\Temp\
    del *.*

    using ** deletes them without asking permission
    hoewever these do not remove folders...only files

    2.How do i Delete All sub Folders in the Temp file?
    cd C:\Documents and Settings\NAGNU\Local Settings\Temp\
    del *FOLDERS????*??


    3.How do i write a batch file for deleting all contents of the folllowing folders?
    a.C:\Documents and Settings\XXX\Cookies\
    b.C:\Documents and Settings\XXX\Local Settings\Temp\
    c.
    C:\Documents and Settings\XXX\Local Settings\Temporary Internet Files\
    d.
    C:\Documents and Settings\XXX\Local Settings-History-Today-My Computer - ........

    The problems here are;
    a.Cookies: contains things like : cookie@dfkdfkdkdkwtf?
    b.Temp: contains folders??
    c.Temporary Internet Files: contains listings Without extensions???
    d.History: I have no clue how to empty todays history since its not in c:\ etc language and has no extensions.????

    or do i have it all wrong and it has to be done another way.....?

    Thank you for your patience in explaining this to me
    or just write the batch and i will figure it out.

    Thanks

  2. Internet, Programming and Graphics   -   #2
    h1
    Guest
    Code:
    @echo off
    cls
    echo Deleting files...
    echo.
    c:
    cd \"documents and settings"\xxx\"local settings"
    deltree/y ..\cookies
    deltree/y temp
    deltree/y "temporary internet files"
    [insert other folders here]
    cd\
    cls
    echo Deletion done.
    echo.
    pause
    cls
    exit

  3. Internet, Programming and Graphics   -   #3
    100%'s Avatar ╚════╩═╬════╝
    Join Date
    Jan 2003
    Posts
    13,383
    :eek: WOW!!! that was fast

    haxor41789 - thats it???!!!!!!
    so little yet so very effective

    okay i've got some serious figuring out to do...........

    If you have a liiiitle bit more energy
    if you dont no problems

    what does @echo off mean?
    what does the echo do?
    in another batch for putting something into the registry it worked as an "ecco" of where the location of the batch was - is that close?
    deltree/y = means delete everything inside
    [insert other folders here]-thanks
    echo Deleting files... : is not really an order but more a guid to the one using it?
    whats the cls?


    If you dont reply - no problems

    Thanks alot

  4. Internet, Programming and Graphics   -   #4
    h1
    Guest
    @echo off means that it will not repeat the directory after every command. Otherwise, it would look like this:
    Code:
    C:\>
    C:\Documents and Settings>
    C:\Documents and Settings\xxx>
    and so forth. The @ symbol makes the command invisible, which can be used on any command.

    echo is basically a print function - it really does nothing. For comments, use rem.

    ECCO is a command line Win NT registry editor.

    You can place the batch file anywhere, on any drive.

    echo Deleting files... is another print command.

    cls clears the screen so it doesn't get messy. This is used at the end because a cls|exit command will close the window instead of waiting for you to exit. exit alone will exit shell, but not the window.

  5. Internet, Programming and Graphics   -   #5
    h1
    Guest
    Hmm... I just checked my PMs... I would recommend removing the qoutes or trying docume~1.

    If you are running Windows NT, 2000, or XP, the deltree command will not work. Go to Start -> Run -> cmd, then type in del/?. There will be a switch (say /x) which will delete directories. In the batch file, change all of the deltree/y commands to del/x. See if that helps.

  6. Internet, Programming and Graphics   -   #6
    100%'s Avatar ╚════╩═╬════╝
    Join Date
    Jan 2003
    Posts
    13,383
    Ive been warping my brain all day, trying different combinations and searching why it didnt work
    i was happy to see your response

    However....... (im using xp)

    if i type del/? in run - an error pop up comes with windows cant find.....

    i changed the deltree/y to del/x - and tried with and without quotes - no good

    i am uncertain how to use the "docume~1" technique ...in the sense i dont know where to put the ~1 eg.
    cd \docum~1 and setti~1\ton~1\local setti~1
    del/x te~1
    you get what i mean???

    Jeeezzz somebody must have written this ages ago..i searched but could not find.
    any more help appreciatted

    the reason why im doing this is 1.out of Pure interest, and want to know
    2.caused because i use public pc's and my girlfriends laptop - shes paranoid about the web and wants me to use the limited user when on the web - and most\all Web\History Cleaners do not function in limited user function (haxor41789 - yes i tried the batch in administrator user everytime)-i would like her and me to have a one clik batch file which does it all.

    (by the way, what "language " is this C+ or msdos or? and what is the most important language to learn nowadays?)

    Thanks again

  7. Internet, Programming and Graphics   -   #7
    h1
    Guest
    Don't do del in run, go to run, then type in cmd to get the prompt.

    del/x isn't a command, I told you to look up what x should be in del/?. I found the command though, and it's del/f/s.

    You should put the ~ after the sixth character. This does not apply to files or folders under 8 characters.

    This would be DOS, or a windows shell script.

    Here's what the file should look like:
    Code:
    @echo off
    cls
    echo Deleting files...
    echo.
    c:
    cd \"documents and settings"\xxx\"local settings"
    del/f/q ..\cookies
    del/f/q temp
    del/f/q "temporary internet files"
    [insert other folders here in the same fashion]
    Code:
    cd\
    cls
    echo Deletion done.
    echo.
    pause
    cls
    exit
    Hope this helps.

  8. Internet, Programming and Graphics   -   #8
    100%'s Avatar ╚════╩═╬════╝
    Join Date
    Jan 2003
    Posts
    13,383
    del/x isn't a command
    ooops

    Okay - i was to shy to ask you for more help yesterday
    because your last solution was better but Only deleted the files in Temp (but not the sub folders)

    so....

    i went deep and found this...
    Code:
    @echo on
    c:
    cd \
    rd /s/q winnt\temp
    md winnt\temp
    cd docume~1\tonjel
    rd /s/q locals~1\tempor~1
    rd /s/q locals~1\history
    rd /s/q locals~1\temp
    md locals~1\temp
    rd /s/q recent
    md recent
    rd /s/q cookies
    pause
    All IE windows must be closed for this to work

    Which deletes everything - except for "history" Only way to combat that is to logout and login to another account that has administrator privliges to wipe out history, index.dat, etc. files.

    heres the result


    im not sure what the rd,md means why he ends it differently than you-

    The Solution has been found - phew that was some process - learnt alot

    Thanks again haxor41789

  9. Internet, Programming and Graphics   -   #9
    h1
    Guest
    That would work, but I was always under the impression that rd did not remove empty folders.

    rd removes (empty?) folders, md makes a folder.

    And in that image, your deletion of history and temporary internet files didn't work. You'll need to be in DOS to do that.

  10. Internet, Programming and Graphics   -   #10
    100%'s Avatar ╚════╩═╬════╝
    Join Date
    Jan 2003
    Posts
    13,383
    your right md made a folder i dont have or need.
    thanks

Bookmarks

Posting Permissions

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