Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help Forums Windows Startup Programs Database Virus, Spyware, and Malware Removal Guides Computer Tutorials Uninstall Database File Database Computer Glossary Computer Resources
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

> Automate CHKDSK and CHKDSK /f to run multiple times
Mr LunchBox
post Jun 30 2009, 02:25 AM
Post #1


Forum Regular
***

Group: HJT Junior Classmen
Posts: 190
Joined: 18-May 09
From: California
Member No.: 332,966



Greetings,

Lately I have been running CHKDSK /f multiple times to fix issues. At one point I ran it probably 5 to 8 times (this is still quicker than re-install of win)

I think I have a batch file that can do it but it doesnt work as I want it to.

I would like to
1> Run CHKDSK if /F is required then run it on next boot
2> Run CHKDSK /f a specific number of times lets say 5
3> Continue the loop.
4> Or a combination of running 5 times but until there are no errors.

I can add the script below to the start menu and it will work fine. However, I would like it to run only if CHKDSK says to run it with /F perhaps using the CHKDSK error codes below and only stop when no more errors are found or run CHKDSK /F when CHDSK says it cant continue due to errors. I can't fine which exit code would be /F and I looked in the event logs but it does not state. I guess I would just say run unless error 0 but I don't know who to integrate the codes with my batch file.

0 Success, no errors found.
1 Success, CHKDSK has detected and fixed major errors.
2 Success, CHKDSK has detected and fixed minor inconsistencies.
3 Error, CHKDSK could not complete.


@echo off
chkdsk.exe c:
if ERRORLEVEL 2 goto ADD_CHECK
echo.
echo The drive is okay this time.
goto end
:ADD_CHECK

reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v BootExecute /t REG_MULTI_SZ /d "autocheck autochk /p \??\C:\0autocheck autochk *" /f
echo.
echo The drive has problems and chkdsk will run next boot

shutdown -r -f -t -10

:end


I am sure this can come in handy to other techs. I just don't have the time to sit looking at the screen.

Eventually I will tie this in with defrag after chkdsk fixes all errors.

Thank you


--------------------
Member of the Bleeping Computer A.I.I. early response team!
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 2)
Billy O'Neal
post Jun 30 2009, 08:32 AM
Post #2


Look buddy -- I'm an Engineer
******

Group: HJT Team Coach
Posts: 8,510
Joined: 17-January 08
From: Northfield, Ohio
Member No.: 184,215



If you have to run chkdsk 5 times, then your hard disk is failing and the drive should be replaced. I hope you have backups....

Billy3


--------------------
Go to the top of the page
 
+Quote Post
Mr LunchBox
post Jul 1 2009, 12:51 AM
Post #3


Forum Regular
***

Group: HJT Junior Classmen
Posts: 190
Joined: 18-May 09
From: California
Member No.: 332,966



I thought about the HD being bad but I also have to take into account that these PC's are on literally weeks without being rebooted let alone turned off. I know that since the HD is (aside from the fans) the only components that is always moving they probably are near their expiration.

I rather do CHKDSK then wait weeks for get an HD purchased approved and purchased. The only good thing the company has is the "My Documents" folder re-directed to the server or have a group policy preventing any documents from being saved on the PC.

I can't say they are cheap, actually wait, yes I can't say that they are freaking cheap while make tons of cash


--------------------
Member of the Bleeping Computer A.I.I. early response team!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 21st November 2009 - 08:19 PM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Virus Removal Guides

© 2003-2009 All Rights Reserved Bleeping Computer LLC.