Go Premium for a chance to win a PS4. Enter to Win


How To Make XP Autochk Run On Abnormal Shutdown

Posted on 2006-06-22
Medium Priority
Last Modified: 2008-01-09
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.
Question by:blafont
  • 5
  • 3
  • 2
  • +1
LVL 30

Expert Comment

by:Marc Z
ID: 16965316
LVL 30

Accepted Solution

callrs earned 375 total points
ID: 16965339
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 want...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....
LVL 30

Expert Comment

by:Marc Z
ID: 16965350
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:

From http://www.windowsbbs.com/showthread.php?t=54392&page=3

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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 16965600
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?
LVL 23

Expert Comment

by:Erik Bjers
ID: 16965744
from the command prompt or run box

run chkdsk /r

chkdsk will run when you restart the computer beofore windows starts
LVL 30

Expert Comment

by:Marc Z
ID: 16968017
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 http://en.wikipedia.org/wiki/Windows_NT_Startup_Process#Kernel_loading_phase
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.
LVL 30

Expert Comment

by:Marc Z
ID: 16968048
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

LVL 30

Expert Comment

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

AVG's better
LVL 30

Expert Comment

by:Marc Z
ID: 16970666
I agree.  I don't know if he has it installed but it was interesting to find.

Author Comment

ID: 16989291
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.
LVL 30

Expert Comment

ID: 16989603
You can use the Windows Task Scheduler to auto-run chkdsk /f
XP http://support.microsoft.com/default.aspx?scid=kb;en-us;308569&sd=tech   

More Chkdsk Info:
http://support.microsoft.com/kb/q187941/     An explanation of CHKDSK and the new /C and /I switches
-> 82. Disable http://www.kellys-korner-xp.com/regs_edits/disablecheckdisk.reg or Enable http://www.kellys-korner-xp.com/regs_edits/enablecheckdisk.reg Check Disk Upon Boot
-> 294. Prevent Check Disk Upon Boot - Undo  http://www.kellys-korner-xp.com/regs_edits/bootexe.reg

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) http://www.archive.freeola.com/m.p.w.basics/Xpwnca-improper-s.shtml
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] http://support.microsoft.com/?kbid=307654 
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 http://www.windowsbbs.com/showthread.php?t=54392
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: http://www.microsoft.com/technet/prodtechnol/winxppro/reskit/c28621675.mspxWindows 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) ?


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question