Results 1 to 5 of 5

Thread: Bat file for CHKDSK - problems with double question, how can I answer yes?

  1. #1
    Xtreme Member
    Join Date
    Feb 2006
    Location
    Lvsitania
    Posts
    177

    Bat file for CHKDSK - problems with double question, how can I answer yes?

    I'm trying to create a bat file so that I can run chkdsk on a drive with a single click. However there is a page file on the drive and even though I can overcome the first question about forcing the drive dismount I'm unable to answer the second about scheduling the chkdsk.

    This is what happens. What can I do to overcome this?


    A64 3800+ X2 3.0Ghz |DFI LanParty UT nF4 Ultra-D |OCZ EL DDR PC4000 Gold GX XTC |Corsair AX850W |XFX 260GTX Black Edition

    Opteron 150 2.8Ghz |Mushkin Redline PC4000 |Asus A8N-SLI |Corsair VX550W |XpertVision 7600GS

  2. #2
    Xtreme Addict
    Join Date
    Sep 2010
    Location
    US, MI
    Posts
    1,680
    Code:
    @ECHO OFF
    
    ECHO Y.|Chkdsk D: /F /X
    That's the simple way of doing it, there was another method that worked on more finiky things that don't except pipes but I can't remember sorry.
    Though the code above will do what you need it to do.

    I would recommend using var's for each drive letter and shortcuts that determine the drive letter.

    Ex.

    Code:
    @ECHO OFF
    
    ECHO Y.|Chkdsk %1: /F /X
    Shortcut:
    Code:
    Chkdsk.bat D
    Or something like that, might take a few tries to get the syntax correct and such on that one (the colon char might need to be removed from the batch and put into the shortcut instead).
    After which you can make a sub folder in your menu system/startmenu and add a shortcut for each one, or whatever you want.
    Regardless the 1st box of of code will do what you need it to do.
    Just remember, "ECHO." means LF-CR or CR probably to be more precise (ie return or enter whatever you wanna call it) .

  3. #3
    Xtreme Member
    Join Date
    Feb 2006
    Location
    Lvsitania
    Posts
    177
    Well, unfortunately, still a no go... It stills stops when faced the same question...

    Last edited by Gak; 01-07-2012 at 06:43 AM.

    A64 3800+ X2 3.0Ghz |DFI LanParty UT nF4 Ultra-D |OCZ EL DDR PC4000 Gold GX XTC |Corsair AX850W |XFX 260GTX Black Edition

    Opteron 150 2.8Ghz |Mushkin Redline PC4000 |Asus A8N-SLI |Corsair VX550W |XpertVision 7600GS

  4. #4
    Xtreme Addict
    Join Date
    Sep 2010
    Location
    US, MI
    Posts
    1,680
    Weird It worked 100% for me last night, after I woke up a min ago it even run the chkdsk on startup on x:, which was my test (my win7 partition).

    The only thing that looks off on your script is the pause, which you use I assume to check your batch file, which of course it would prompt you to press any key type of deal.
    I should be going right passed the prompt for Y or N...

    Try it from the cmd line it's self instead of batch and it'll work.

  5. #5
    Xtreme Member
    Join Date
    Feb 2006
    Location
    Lvsitania
    Posts
    177
    Disregard my last post. I don't know where my head was. Maybe I just wasn't sufficiently woken up.

    It is working fine. The /x switch did the trick.

    And thanks for the help!

    I've done the following for convenience, just want to run the batch once a week or so and also because I don't know that much about batch files.

    Code:
    C:
    
      @ECHO OFF
    
        ECHO y|Chkdsk C: /f
        ECHO y|Chkdsk D: /f /x
               Chkdsk E: /f
               Chkdsk F: /f
               Chkdsk G: /f
    
    Shutdown /r
    
    pause
    Last edited by Gak; 01-07-2012 at 01:29 PM.

    A64 3800+ X2 3.0Ghz |DFI LanParty UT nF4 Ultra-D |OCZ EL DDR PC4000 Gold GX XTC |Corsair AX850W |XFX 260GTX Black Edition

    Opteron 150 2.8Ghz |Mushkin Redline PC4000 |Asus A8N-SLI |Corsair VX550W |XpertVision 7600GS

Bookmarks

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
  •