How To Make XP Autochk Run On Abnormal Shutdown

Can someone please advise on what I need to do to add autochk (chkdsk c: /f) when I have to power cycle the system or a system error occurs and reboots without a graceful shutdown?

I have looked at msconfig -> Advanced and autochk is not listed as an option to select.

Thank you.
Who is Participating?
callrsConnect With a Mentor Commented:
Windows does that automatically.
But if you really want to, then open notepad & copy this line to it: chkdsk c: /f

Now save the file as: C:\autochk.bat

Now, copy that file to your Startup Folder in the Start menu:
- Start -> Run -> Explorer
- Go to C: root drive & file & right-click the file u just saved & click Copy
--> Right click Start, Click Explore --> Navigate to the Start Menu -> Programs -> Startup, now Right-click & hit Paste

Now that command will run EVERY time you login. But thats not what you only want it to run when system powers off ungracefully. I don't know how to find out from windows if it did or didn't shut down properly. But like I said, Windows knows when it didn't shut down normally & so runs the disk check on next bootup....
Marc ZCommented:
Marc ZCommented:
A one line batch file set to run weekly or at whatever interval you like in Scheduled Tasks (control panel) should do it, at the next boot (substitute your disk letter for X).

fsutil dirty set X:


This doesn't address the bad shutdown but as callrs says, Windows is supposed to do that automatically.
The fsutil will set the Dirty Bit which will then activate Autochck.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

blafontAuthor Commented:
Nice input  mtz1of4. Thanks for the details.

Here's the weird part, I have had to perform a hard reset when the system has locked up. XP came back up without running chkdsk c: /f. After the reboot I set the system to run chkdsk c: /f on the next reboot by running chkdsk c: /f from a dos prompt which, of course, it could not do because it was in use by the system and asked if I wanted to run chkdsk on the next reboot. Chkdsk c: /f then ran on the next reboot and found errors. But, to your point, the errors may not have not been a Dirty sector and therefore not requiring chkdsk to run. If I recall properly, the errors had to deal with Security Descriptors and another type of error that I cannot recall.

So, do you think the system should have run chkdsk c: /f  when there were at least some type of errors present on the partition?
Erik BjersPrincipal Systems AdministratorCommented:
from the command prompt or run box

run chkdsk /r

chkdsk will run when you restart the computer beofore windows starts
Marc ZCommented:
The quick reading I did on those posts I linked to indicate that MS doesn't really tell us which bit actually causes the fsutil to run to start the chckdsk program.  The errors you point to in your last post won't show up until the chkdsk is run, so how would windows know to run unless it had run into the error on the disk?

From this
During the Kernel Loading Phase , Autochck runs every boot but only turns on chkdsk if it finds the dirty bit.  My guess is here that there was nothing waiting in memory to be written when you had to Hard Restart so the dirty bit was reset on the hard shutdown.
Marc ZCommented:
I di just find this also.  Interesting, see if it applies to your situation.
Chkdsk /f does not run on restart
Fix ID: 1-2KFHVQ
Situation: When Realtime Protection is set to load at system start, chkdsk /f (which runs chkdsk after the computer restarts) does not run. If Realtime Protection is set to load at Symantec AntiVirus start, chkdsk /f runs normally.
Solution: Fixed in Auto-Protect 9.4.
The above was from MR4 for Symantec AntiVirus Corporate Edition

Norton. Hmm. Yikes. Norton AV's caused  system restore to fail too on so many systems..

AVG's better
Marc ZCommented:
I agree.  I don't know if he has it installed but it was interesting to find.
blafontAuthor Commented:
No, I don't have Norton AV installed. I use McAfee instead but I do appreciate all of the responses.

I think my best alternative is to weekly run chkdsk c: to see if there are errors..

Thanks everyone.
You can use the Windows Task Scheduler to auto-run chkdsk /f

More Chkdsk Info:     An explanation of CHKDSK and the new /C and /I switches
-> 82. Disable or Enable Check Disk Upon Boot
-> 294. Prevent Check Disk Upon Boot - Undo

You've closed the topic, but the fact that it's unresolved it bothers me... THE REAL SOLUTION would be to find out if an improper shutdown occurred & then run chkdsk based on that. But how to know? Here's my take:

-- Find out from some Windows setting. But which setting?
-- Create your OWN SETTING that runs every time you properly shut down. Then when you boot back up, you check if your flag has been set. IF it has, then no worry. If it has not, then you know it's time to chkdsk...This method seems simple to implement.

Interesting extracts from two related chats:

--> XP pro will not chkdsk after improper shutdown. (Windows XP Tips)
A=ABC, R=Rick, S=Sharon F. Chat June 5-7, 2005

A: Found out by accident. My XP pro won't run chkdsk after improper shutdown.   I have installed to many new software since my last improper shutdown so I do not know if these have anything to do with it.   Help.

R: Hi, Insert the WinXP CD and restart the system to boot from it, you want to load the Recovery Console by hitting 'r' when first prompted. Run "chkdsk C: /r" from there. If prompted for autochk.exe, indicate C:\Windows\system32.   HOW TO: Install and Use the Recovery Console in Windows XP [Q307654] 
A: Will this just chkdsk once, or will it solve the problem?

R: That will just run chkdsk once. If the system tries to run chkdsk at every boot, then open a command prompt  (start/run cmd) and run "chkntfs /d" to clear the dirty bit that prompts it.
A: My problem is that XP will NOT run chkdsk after improper shutdown. How can I restore this function?

R: Right, that's why I gave instructions on how to run a manual scan, and then clear the dirty bit. Next time the system is shut down improperly, it should reset it.

S: Chkdsk does not run after every improper shutdown. It only runs if an inconsistency is found during the auto-check that occurs at startup. If no inconsistency is found, chkdsk is skipped and Windows proceeds with the boot. If you want extra assurance that all is okay, run chkdsk manually as already described in this thread.
A: Thank you, thankyou. That makes my feel so much better.    But running "chkntfs /d "(as advised by Rick) would not hurt even if my machine is "normal", right?

S: Right. :)

--> Running chkdsk after dirty shut down - Windows BBS
r=rsinof, s=sparrow, a=Arie, z=Zander. Chat May 20-22, 2006
r: Is there any way to run chkdsk automatically after dirty shutdown on NTFS partitions just like old Win9x days ?
s: Chkdsk is run at every boot of XP. To see it add /sos to boot.ini after the other arguments on the XP line.
r: But how to run it with /f parameter, so that it can fix the damages ?
a: If there is no damage, there's no reason to run it with the /f parameter.    When it detects problems, it will prompt you for action.   Remember, NTFS is more robust then FAT!
s: :) I have FAT and it fixes automatically. You can watch it!

r: Agreed that NTFS is more robust than FAT, but even it requires some basic house cleaning.    My problem is that I have to support some 100 odd pcs at different locations and running chkdsk manually every week is becoming a big problem. On top of that we have quite severe power shortage out here & its very hot so PC's keep on hanging & rebooting. So I need a way to run chkdsk /f automatically if the system shutdown was dirty.
r: Sparrow, I don't normally recommend that people use FAT with XP unless they have some specific requirement - like sharing partition(s) with other OS (Win9x, Linux) or some other program which does not run on NTFS ( a major accounting program comes to mind) - and never ever in business environment.    Perhaps you should also start using NTFS & dump FAT :)

z: Q:[Chkdsk is run at every boot of XP.] Can't say that mine does. However, if my computer is shut down improperly, chkdsk always runs just like the old win 9X days. I get no prompt to fix it, it just does it on it's own. It does show what it fixed (if anything) but it goes by pretty fast so I generally have to look at the event viewer to see what it did.    I always thought it did that by default???? I've never done anything to make it work that way. It just does.
r: This has me confused. Perhaps chkdsk runs on FAT partition (ala Win9x) and not on NTFS partiotion, or perhaps you need a switch to enable it in both.   As per Microsoft, you have to run chkdsk manually on NTFS ?

z: I don't really know, but, I'm using Fat32. Maybe that's why it runs for me?
r: Yes - XP is emulating 9x. But what about NTFS?
a: "Chkdsk.exe is a command-line tool that verifies the logical integrity of a file system on a Windows XP Professional volume. If file system structures become damaged, Windows XP Professional automatically schedules Chkdsk to run the next time the computer is restarted. At any time, you can manually run Chkdsk at the command prompt or from Windows Explorer or My Computer." Source: XP Professional Resource Kit - Troubleshooting Disks and File Systems

r: Illuminating to say the least, but I have yet to see any NTFS system running chkdsk automatically after a dirty boot & this includes Win 2k, Win 2k3, XP & server editions.    Maybe the automatic checking is reserved for such instances that the volume becomes unmountable & unreadable and then only it starts checking, but if one waits for so long for this, I think the volume is a gone case anyway and one can expect massive data loss on it.
s: Q:[use FAT with XP... never ever in business environment.] Agree 100%; my computers are at home; I'm retired, and feel NTFS is not suitable for folks at home. Have seen too many problems there, probably stemming from lack of IT help that is available to corporations.   You haven't turned off the XP splash screen as was suggested if you still haven't seen chkdsk running automatically at boot on NTFS partitions.
r: Ok would do that but does it fixes anything or does it only checks & reports the error (aka chkdsk without any switches) ?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.