Trouble with my batch file.
Results 1 to 9 of 9

Thread: Trouble with my batch file.

  1. #1
    Junior Member
    Join Date
    May 2004
    Posts
    15

    Trouble with my batch file.

    Hi, I am having some trouble with my batch file:

    =====
    @echo
    cd\
    del C:\Documents and Settings\'\Cookies\*.*
    del C:\Documents and Settings\'\temp\*.*
    del C:\Documents and Settings\'\recent\*.*
    del C:\Documents and Settings\'\Local Settings\History\*.*
    del C:\Documents and Settings\'\Local Settings\Temp\*.*
    del C:\Documents and Settings\'\Local Settings\Temporary Internet Files\*.*
    pause
    =====


    Each time I run it, it tells me "the system cannot find the path specified". I believe the path is correct because I have my folder options set to show the full path in the top bar and that is how it looks, verbatim. What am I doing wrong, I know it has to be something simple I just can't seem to be able to figure it out?

    Thanks in advance.

    ~.bat-man

  2. #2
    AO French Antique News Whore
    Join Date
    Aug 2001
    Posts
    2,126
    =====
    @echo
    cd\
    del C:\Documents and Settings\%Username%\Cookies\*.*
    del C:\Documents and Settings\%Username%\temp\*.*
    del C:\Documents and Settings\%Username%\recent\*.*
    del C:\Documents and Settings\%Username%\Local Settings\History\*.*
    del C:\Documents and Settings\%Username%\Local Settings\Temp\*.*
    del C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\*.*
    pause
    =====

    That should help.
    -Simon \"SDK\"

  3. #3
    Junior Member
    Join Date
    May 2004
    Posts
    15
    Hey SDK, is it not working because the username on both my accounts is ' and ''? Maybe if I changed them to a standard character it would work? What do you think? I'm not sure why I use those types of characters as my usernames, I just always have.

    PS: thanks a ton for helping me out!

    ~.bat-man

    Ok, I just set up another account named "wayne" and the batch file wouldn't work from there either. Same error message. Not sure what the heck is going wrong, the syntax looks correct now? These paths do exist on my computer...

  4. #4
    Junior Member
    Join Date
    May 2004
    Posts
    15
    Ok SDK, I finally got that puppy to work. For some reason putting quotes around the files I was wanting to delete made the thing work.

    Like this:

    ========

    @echo
    cd\
    del "C:\Documents and Settings\%Username%\Cookies\*.*" /F /Q
    del "C:\Documents and Settings\%Username%\temp\*.*" /F /Q
    del "C:\Documents and Settings\%Username%\recent\*.*" /F /Q
    del "C:\Documents and Settings\%Username%\Local Settings\History\*.*" /F /Q
    del "C:\Documents and Settings\%Username%\Local Settings\Temp\*.*" /F /Q
    del "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\*.*" /F /Q
    pause


    ========

    Voila!

    I'm just glad the dang thing is working! Thanks again SDK, the %username% thing works well, because it determines who you are and then deletes the files accordingly. Pretty neat! And why the hell doesn't del /? tell you that you are supposed to use quote tags for things like this to work!?

    ~.bat-man

    This one works well too:

    =======

    @echo
    cd\
    rmdir "C:\Documents and Settings\%Username%\Cookies\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\temp\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\recent\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\History\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temp\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\" /Q /S
    pause


    =======

  5. #5
    AO French Antique News Whore
    Join Date
    Aug 2001
    Posts
    2,126
    Np Welcome to AO.
    -Simon \"SDK\"

  6. #6
    The reason the batch file didn't work without the qoutes around the path is that the spaces in Documents and Settings. You del or rmdir without qoutes as long as your path doesnt have any spaces in it.

  7. #7
    Junior Member
    Join Date
    May 2004
    Posts
    15
    Originally posted here by SDK
    Np Welcome to AO.
    Thanks!

    Originally posted here by wyred
    The reason the batch file didn't work without the qoutes around the path is that the spaces in Documents and Settings. You del or rmdir without qoutes as long as your path doesnt have any spaces in it.
    Thank you for explaining that ,wyred. I was wondering about that.

    This is what I finally came up with for myself:

    =======

    @echo
    cd\
    del "C:\Documents and Settings\%Username%\Cookies\*.*" /F /Q /S
    del "C:\Documents and Settings\%Username%\temp\*.*" /F /Q /S
    del "C:\Documents and Settings\%Username%\recent\*.*" /F /Q /S
    del "C:\Documents and Settings\%Username%\Local Settings\History\*.*" /F /Q /S /A H R S
    del "C:\Documents and Settings\%Username%\Local Settings\Temp\*.*" /F /Q /S
    del "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\*.*" /F /Q /S /A H R S
    del "C:\Documents and Settings\%Username%\My Recent Documents\*.*" /F /Q /S
    del "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\*.*" /F /Q /S
    del C:\WINDOWS\Temp\*.* /F /Q /S /A H R S
    del index.dat /s /f /q
    del *.tmp *.chk *.$$$ *.~ *.~~~ *.temp *.trc *.bak *.mov *.mpeg *.mp3 *.wav *.tiff *.mpg *.ram *.scr /s /q /f
    rmdir "C:\Documents and Settings\%Username%\Cookies\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\temp\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\recent\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\History\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temp\" /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\" /Q /S
    pause

    =======

    Nice and sloppy, just the way I like it!


    ~.bat-man

  8. #8
    Junior Member
    Join Date
    May 2004
    Posts
    15
    Just wanted to add that this works much better:

    *******

    @echo
    cd\
    del "C:\Documents and Settings\%Username%\Cookies\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\Cookies\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Cookies\"
    del "C:\Documents and Settings\%Username%\temp\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\temp\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\temp\"
    del "C:\Documents and Settings\%Username%\recent\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\recent\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\recent\"
    del "C:\Documents and Settings\%Username%\Local Settings\History\*.*" /F /Q /S /A H R S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\History\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Local Settings\History\"
    del "C:\Documents and Settings\%Username%\Local Settings\Temp\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temp\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Local Settings\Temp\"
    del "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\*.*" /F /Q /S /A H R S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\"
    del "C:\Documents and Settings\%Username%\My Recent Documents\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\My Recent Documents\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\My Recent Documents\"
    del "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\*.*" /F /Q /S
    rmdir "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\" /Q /S
    mkdir "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\"
    del C:\WINDOWS\Temp\*.* /F /Q /S /A H R S
    rmdir C:\WINDOWS\Temp\ /Q /S
    mkdir C:\WINDOWS\Temp\
    del "C:\WINDOWS\Temporary Internet Files\*.*" /F /Q /S /A H R S
    rmdir "C:\WINDOWS\Temporary Internet Files\" /Q /S
    mkdir "C:\WINDOWS\Temporary Internet Files\"
    del C:\WINDOWS\Cookies\*.* /F /Q /S /A H R S
    rmdir C:\WINDOWS\Cookies\ /Q /S
    mkdir C:\WINDOWS\Cookies\
    del C:\TEMP\*.* /F /Q /S
    rmdir C:\Temp\ /Q /S
    mkdir C:\Temp\
    del index.dat /S /F /Q
    del *.tmp *.chk *.$$$ *.~ *.~~~ *.temp *.trc *.bak *.mov *.mpeg *.wav *.tiff *.mpg *.ram *.scr *.old *.avi /S /F /Q
    pause

    *******

    Remaking the directories has worked out much better for me and has resulted in more funtionality. The other one had some slightly undesirable effects... (as it turns out, some of those directories don't remake themselves like the others do) if they exist at all.... lol

    ~.bat-man

  9. #9
    Junior Member
    Join Date
    May 2004
    Posts
    15
    Just wanted to add that this works much better:

    *******

    @echo
    cd\
    del "C:\Documents and Settings\%Username%\Cookies\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\Cookies\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Cookies\"
    del "C:\Documents and Settings\%Username%\temp\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\temp\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\temp\"
    del "C:\Documents and Settings\%Username%\recent\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\recent\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\recent\"
    del "C:\Documents and Settings\%Username%\Local Settings\History\*.*" /F /Q /S /A H R S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\History\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Local Settings\History\"
    del "C:\Documents and Settings\%Username%\Local Settings\Temp\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temp\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Local Settings\Temp\"
    del "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\*.*" /F /Q /S /A H R S
    rmdir "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\"
    del "C:\Documents and Settings\%Username%\My Recent Documents\*.*" /F /Q /S
    rmdir "C:\Documents and Settings\%Username%\My Recent Documents\" /Q /S
    mkdir "C:\Documents and Settings\%Username%\My Recent Documents\"
    del "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\*.*" /F /Q /S
    rmdir "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\" /Q /S
    mkdir "C:\WINDOWS\Temp\Temporary Internet Files\Content.IE5\"
    del C:\WINDOWS\Temp\*.* /F /Q /S /A H R S
    rmdir C:\WINDOWS\Temp\ /Q /S
    mkdir C:\WINDOWS\Temp\
    del "C:\WINDOWS\Temporary Internet Files\*.*" /F /Q /S /A H R S
    rmdir "C:\WINDOWS\Temporary Internet Files\" /Q /S
    mkdir "C:\WINDOWS\Temporary Internet Files\"
    del C:\WINDOWS\Cookies\*.* /F /Q /S /A H R S
    rmdir C:\WINDOWS\Cookies\ /Q /S
    mkdir C:\WINDOWS\Cookies\
    del C:\TEMP\*.* /F /Q /S
    rmdir C:\Temp\ /Q /S
    mkdir C:\Temp\
    del index.dat /S /F /Q
    del *.tmp *.chk *.$$$ *.~ *.~~~ *.temp *.trc *.bak *.mov *.mpeg *.wav *.tiff *.mpg *.ram *.scr *.old *.avi /S /F /Q
    pause

    *******

    Remaking the directories has worked out much better for me and has resulted in more funtionality. The other one had some slightly undesirable effects... (as it turns out, some of those directories don't remake themselves like the others do) if they exist at all.... lol

    ~.bat-man

Posting Permissions

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