Automated chkdsk : For Windows XP

Overview:
How to run chkdsk on multiple disks from a .bat

  • force dismount
  • automatically fix errors
  • automatically answer "Y" to the (Y/N) question -See F1 for credits-
  • force a restart at the end so that C: and any other partitions
    unable to chkdsk in Windows can do so after a restart

NOTE: this must be run in the root of C: so save your .bat file to C:
You can, of course, create a shortcut to the .bat and run it from anywhere you choose.

echo y|chkdsk /f
shutdown -r -t 05

Copy the above 2 lines into notepad or your favorite .txt editor and save it with the extension
.bat in the root of your C: drive.


This .bat file will:
1) echo the answer Y to the question
2) schedule a chkdsk C: /f for the next time windows restarts
3) automatically fix errors ( /f )
3) initiate a restart with a count down of 05 seconds


And now a more complex version:

echo y|chkdsk /f
chkdsk D: /x /f
chkdsk E: /x /f
chkdsk F: /x /f
chkdsk G: /x /f
chkdsk H: /x /f
chkdsk i: /x /f
J:
chkdsk_J_restart.bat

This .bat file will:
1) echo the answer "Y" to the question
2) schedule a chkdsk C: /f for the next time windows starts
3) force a dismount of D: through i: chkdsk and automatically fix errors
4) switch to J:
5) run the .bat file called "chkdsk_J_restart.bat" which resides in the root of the J: drive


And now the contents of chkdsk_J_restart.bat which is saved in the root of my J: drive:
Note: this must be saved to the root of the intend drive.

echo y|chkdsk /x /f
shutdown -r -t 05

This .bat file will:
1) echo the answer Y to the question
2) schedule a chkdsk J: /f for the next time windows restarts
3) automatically fix errors ( /f )
3) initiate a restart with a count down of 05 seconds


Foot Note 1: Special thanks to "Glennbo" (supergeek, DOS guru, and multi-talented musician)
for the tutorial on "Pipe" "|", echo, and the specific syntax to use to make the above run.

Return to PC Help Desk Main Page

Click for Contact