1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

automate check disk and defrag winxp

Discussion in 'Windows XP' started by rodger, 2004/09/23.

Thread Status:
Not open for further replies.
  1. 2004/09/23
    rodger

    rodger Inactive Thread Starter

    Joined:
    2002/01/08
    Messages:
    133
    Likes Received:
    0
    Hi I am trying to automate disk check and defrag and have created the command and also A txt file to enable it to know which disks to check but when I run the command it says it can not find the file DrvLtr.txt. which I have created and put into the same directory as the Batch file.
    But not sure why it should not be able to find the file?

    Regards
    Rodger

    Thankyou in advance.
     
  2. 2004/09/23
    Steve R Jones

    Steve R Jones SuperGeek Staff

    Joined:
    2001/12/30
    Messages:
    12,317
    Likes Received:
    252
    Post the contents of the batch file.
     

  3. to hide this advert.

  4. 2004/09/23
    rodger

    rodger Inactive Thread Starter

    Joined:
    2002/01/08
    Messages:
    133
    Likes Received:
    0
    REM chkdsk and defrag automation
    for /F "eol= tokens=1 delims=( " %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk

    :dsKchk
    If %DrvLtr% == end goto :eof
    chkdsk %DrvLtr%
    If not errorlevel 3 goto :defrag
    If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon

    :dskchkoff
    cd\
    %DrvLtr%
    echo Y chkdsk /F /R
    goto :defrag

    :dskchkon
    chkdsk %DrvLtr% /F /R

    :defrag
    cd\
    %DrvLtr%
    defrag %DrvLtr% -b
    defrag %DrvLtr%
    :EOF


    Thanks steve

    Rodger.
     
  5. 2004/09/24
    Johanna

    Johanna Inactive Alumni

    Joined:
    2003/03/08
    Messages:
    2,402
    Likes Received:
    2
    This doesn't answer your question, but, FYI, XP seldom needs defragged. It does quite a bit on the fly. I can't remember the last time I ran checkdisk on my own comp, either.

    But if you really need these to run regularly, why not use the Task Scheduler? Wouldn't that be easier than the batch file?

    Johanna
     
  6. 2004/09/24
    rodger

    rodger Inactive Thread Starter

    Joined:
    2002/01/08
    Messages:
    133
    Likes Received:
    0
    Have you any ideas on this steve?
     
  7. 2004/09/24
    Steve R Jones

    Steve R Jones SuperGeek Staff

    Joined:
    2001/12/30
    Messages:
    12,317
    Likes Received:
    252
    Who Me?
    I only know that people that can help couldn't do it without seeing the file ;)
     
  8. 2004/09/24
    rodger

    rodger Inactive Thread Starter

    Joined:
    2002/01/08
    Messages:
    133
    Likes Received:
    0
    ok well here's hoping :)

    rodger
     
Thread Status:
Not open for further replies.

Share This Page

  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.