Batch file to run CheckDisk

E

Evi

I use a little batch file to run CheckDisk. It contains nothing more than
chkdsk c: /f /r

This brings up a little window which asks me if I want to run CheckDisk when
the PC restarts and I answer Yes.

Is there anythign I can add to the batch file to tell it that I DO want it
to run next time the PC starts rather than typing in 'Y'?

And is there anything I could add to the batch file that would actually
restart the PC?

I would quite like to run ChkDsk as a scheduled task.
Evi
 
P

Pegasus \(MVP\)

Evi said:
I use a little batch file to run CheckDisk. It contains nothing more than
chkdsk c: /f /r

This brings up a little window which asks me if I want to run CheckDisk when
the PC restarts and I answer Yes.

Is there anythign I can add to the batch file to tell it that I DO want it
to run next time the PC starts rather than typing in 'Y'?

And is there anything I could add to the batch file that would actually
restart the PC?

I would quite like to run ChkDsk as a scheduled task.
Evi

To force checkdisk to run without a prompt:

echo Y|chkdsk c:\ /f

To reboot the PC, use shutdown.exe. It comes with the Win2000
Resource Kit. I believe a similar tool is available from
www.sysinternals.com.
 
E

Evi

Pegasus (MVP) said:
To force checkdisk to run without a prompt:

echo Y|chkdsk c:\ /f

To reboot the PC, use shutdown.exe. It comes with the Win2000
Resource Kit. I believe a similar tool is available from
www.sysinternals.com.

I tried
echo Y|chkdsk c:\ /f /r

but nothing happened. Was the /r bit wrong?

What is the Win2000 Resource Kit? Is it on the Win2000 CD or does it mean
giving Mr Gates more pennies?
Evi
 
P

Pegasus \(MVP\)

Evi said:
want

I tried
echo Y|chkdsk c:\ /f /r

but nothing happened. Was the /r bit wrong?

What is the Win2000 Resource Kit? Is it on the Win2000 CD or does it mean
giving Mr Gates more pennies?
Evi

Test your command until you have it just right, then
add the "echo Y | " part in front.

Mr. Gates does indeed want more pennies for the Win2000
Resource Kit. It's a separate product.
 
E

Evi

Test your command until you have it just right, then
add the "echo Y | " part in front.

Mr. Gates does indeed want more pennies for the Win2000
Resource Kit. It's a separate product.

Thanks for the hint. I'll keep trying
Evi
 
T

Torgeir Bakken \(MVP\)

Evi said:
I tried
echo Y|chkdsk c:\ /f /r

but nothing happened. Was the /r bit wrong?

What is the Win2000 Resource Kit? Is it on the Win2000 CD or does it mean
giving Mr Gates more pennies?
Hi

Some parts of the resource kit is freely downloadable, some are not.
Shutdown.exe is in the not free part.

Use PsShutdown.exe in the free PsTools suite (as Pegasus indicated).
It is superior to the one in the resource kit as well.

http://www.sysinternals.com/ntw2k/freeware/pstools.shtml
 
R

Ricardo M. Urbano - W2K/NT4 MVP

Evi said:
I tried
echo Y|chkdsk c:\ /f /r

but nothing happened. Was the /r bit wrong?

What is the Win2000 Resource Kit? Is it on the Win2000 CD or does it mean
giving Mr Gates more pennies?
Evi

It might seem like nothing happened. That is because there wouldn't be
a prompt. The y is echoed to the stdin, so there's no need for the util
to prompt. So you would get the command prompt back like nothing
happened. At next boot, the chkdsk would run. BTW, the /r switch
implies /f, so /f is actually redundant in your command.
 
E

Evi

Ricardo M. Urbano - W2K/NT4 MVP said:
It might seem like nothing happened. That is because there wouldn't be
a prompt. The y is echoed to the stdin, so there's no need for the util
to prompt. So you would get the command prompt back like nothing
happened. At next boot, the chkdsk would run. BTW, the /r switch
implies /f, so /f is actually redundant in your command.

I got the spaces wrong. That's why it didn't work (I know it didn't because
it didn't checkdisk on reboot). I've got it right now, its:
echo Y | chkdsk c: /f /r

What would I write to make it check my second hard drive, D:, at the same
time? That always asks two question in a normal command prompt - do I want
to dismount the volume, to which I answer 'No' and do I want to run
checkdisk at the next reboot, to which I answer 'Yes'

Thanks everyone, for getting me this far.
Evi
 
R

Ricardo M. Urbano - W2K/NT4 MVP

Evi said:
I got the spaces wrong. That's why it didn't work (I know it didn't because
it didn't checkdisk on reboot). I've got it right now, its:
echo Y | chkdsk c: /f /r

What would I write to make it check my second hard drive, D:, at the same
time? That always asks two question in a normal command prompt - do I want
to dismount the volume, to which I answer 'No' and do I want to run
checkdisk at the next reboot, to which I answer 'Yes'

Thanks everyone, for getting me this far.
Evi

I just did the following at the command prompt and it seemed to work:

echo nn| chkdsk d: /r

Note, that the second question was asked presumably because a carriage
return must have been thrown in there somehow, but if you change the
command to:

echo ny| chkdsk d: /r

should work.

GL!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top