General discussion


Automating Chkdsk

By EdLockett ·
I want my workstations to check for and repir errors on their local c: drive during the evening.
There is a TechRepublic download for automating chkdsk and defrag. I downloaded this, but there is a bug in it. The code contains the line
echo Y chkdsk /f /r
Of course the result of this command is that "Y chkdsk /f /r" is echoed to the screen. This is not the desired result. What we want to do is tell chkdsk to run in fix mode upon the next reboot. There does not seem to be any way of telling chkdsk to do this without manually having to press the Y key. How is one supposed to schedule a disk check that will fix errors that it finds? Surely there must be a way!
Thank you in advance for your advice.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by rindi1 In reply to Automating Chkdsk

Create an empty file with the name Y in the same directory where your chkdsk.exe is.

Replace the code with the following:

chkdsk /f /r <Y

That should do it.

Collapse -

by EdLockett In reply to

Thanks for your help, but the below solution was easier.

Collapse -

by sgt_shultz In reply to Automating Chkdsk

i believe you are simply missing the 'pipe' character between the Y and chkdsk. i will type it here but in case it won't html, it is the shift backslash key (above the enter key)
echo Y|chkdsk. yes, it looks like a vertical line typed it this way: 'echo Y and pipe it to the chkdsk command' i believe the explanation is pipe takes the console output and redirects it to whereever you say. hopefully it works that way in xp also

Collapse -

by EdLockett In reply to

Thanks a lot. Got it sorted now.

Collapse -

by EdLockett In reply to Automating Chkdsk

This question was closed by the author

Collapse -

Autonatubg chkdsk

by ekson73 In reply to Automating Chkdsk

The correct command can be find at

echo y|chkdsk [target drive, i.e. ] /f/r

Related Discussions

Related Forums