This is from my reference to scandisk at
www.mvps.org/serenitymacros/winprogs.html
It shows the difference between Scandisk for Dos and Scandisk for Windows. Without knowing how Chkdsk fixes disks (dos or windows fashion) I hypothsis that it may be better to use this to rescue a disk.
Runs the ScanDisk disk-repair program.
To check and repair a drive, use the following syntax:
Scandisk
SCANDISK [drive: | drive:\DRVSPACE.nnn]
Drive: Drive to check
drive:\DRVSPACE.nnn The unmounted drivespace drive to check. This is the only way to check an unmounted drivespace in Windows.
None Checks and repair the current drive
/All Checks and repairs all local drives.
/Autofix Fixes damage without prompting.
/Checkonly Checks a drive, but does not repair any damage.
/Custom Configures and runs ScanDisk according to SCANDISK.INI settings.
/Nosave With /AUTOFIX, deletes lost clusters rather than saving as files.
/Nosummary With /CHECKONLY or /AUTOFIX, prevents ScanDisk from stopping at summary screens.
/Surface Performs a surface scan after other checks.
/Mono Configures ScanDisk for use with a monochrome display.
/Fragment [drive:][path] filename Examine a file for fragmentation: Works in Windows
/Undo [drive:] To undo repairs you made previously. Where [drive:], specifes the drive containing your Undo disk.
/Time Monitor the average read, write, and seek times during surface analysis. This detects sectors that are about to go bad but can still be read. This is the same as ScanTimeOuts in scandisk.ini.
/Text Runs Scandisk as a MS-Dos prompt command. Can check but not fix problems.
/Help Displays command line help.
/Noui /Clip /Nolost /Mount /New
Scandisk at Startup
When Windows detects that it hasn't shut down properly it sets the bit 4 of byte 8 of the FAT, if it detects a disk error it sets bit 3. Win.com will run Scandisk at the next boot.
By coping another file and calling it Scandisk.alt into the Windows\Command directory Win.com will execute this file instead.
Editing MSDos.sys in the root directory can control if Scandisk is run or not. The [Options] section should be there already, don't duplicate.
[Options]
Autoscan=20 Never
1 After prompting
2 Always.
Scandisk.Ini
See Scandisk.ini in the Windows\Command directory for customising how Scandisk runs when started with the /custom switch. This is a fully commented file.
Only Scandisk uses Scandisk.ini, Scandskw doesn't.
Click here for your Scandisk.ini (assumes you've installed Windows to C:\Windows)
ScandskW.
Scandskw should be used if you have disk problems and can start Windows. There are two copies of the FAT on every disk. These track what parts of the disk the file is on. Where the beginning of the file starts is stored in the directory and the rest of it including the end is stored in the FAT. Dos and Windows only use the first FAT and copies it to the second as a backup.
Scandisk only uses the first FAT to repair disks and copies it over the second after it repairs it. Scandskw uses both FATS to make repairs, using the best information from each.
Scandskw [Drive] [/Allfixeddisks] [/Noninteractive] [/Preview] [/Oldfs] [/Silent] [/Sageset:x] [/Sagerun:x]
Drive The drive or drives to test.
/Allfixeddisks Test all fixed disks.
/Noninteractive Doesn't pause for additional user information. Displays summary screens.
/Preview Test but doesn't fix any errors.
/Oldfs Changes the File System to normal Dos. Removes all long file names.Destructive, can't be undone.Must be run from a Command Prompt.
/Silent Exits without displaying summary screens.
/Sageset:x Display the System Agent-Aware Setting dialog box and store the settings in the SETn registry key.
/Sagerun:x Runs in unattended mode using the System Agent-aware settings in the SETn registry key.
Scandskw is only a starter application. Dskmaint.dll does all the work.
Registry Settings
Scandskw stores it's settings under the following registry key.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\CheckDrive "Settings"=hex:nn,nn,nn,nn
Where the numbers read from right to left.
Add the numbers from the chart below using calculator in hex mode, pad it out to 8 digits with leading zeros and reverse it.
Type of test
Standard test &1
Through test &0
Automatically fix errors
Areas of the disk to scan
Scan system & data areas &0
Scan system areas only &80
Scan data areas only &40
Do not perform write testing Not stored
Do not repair sectors in hidden and system files &3 000
Display Summary
Always &0
Never &10
Only if errors found &40 000
Log file
Replace log &0
Append to log &10 000 000
No log &80 000
Cross linked files
Delete &4 000
Make copies &2 000
Ignore &0
Lost file fragments
Free &0
Convert to files &2
Check files for
(Don't check) Invalid file names &4
Invalid dates and times &8
Duplicate names &2 000 000
(Don't check) Check Host &2 000
Report MS-Dos mode name length errors &40 000
Can only be set in registry
Retest sectors marked badThis is not a setting that should be used unless you have marked sectors bad accidently.Normally sectors are marked bad because they are unreliable. &40 000 000
Task Scheduler
This section tell Task Scheduler that Scandskw is a Task Scheduler aware program (it recognises sageset and sagerun command line parameters).
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Plus!\SystemAgent\SAGE\Scandisk for Windows]
"Settings"=hex:01
"Program"="SCANDSKW.EXE"
"FriendlyName"="ScanDisk for Windows"
These are the codes scandskw returns when it finishes running. Task Scheduler prints the string in schedlog.txt.
[HKEY_LOCAL_MACHINE\Software\Microsoft\Plus!\SystemAgent\SAGE\Scandisk for Windows\Result Codes]
"Success"="1"
"0"="No errors found"
"1"="Errors found and all were fixed"
"249"="One or more drives could not be checked"
"250"="Drive could not be checked - could not load or find DSKMAINT.DLL"
"251"="Drive could not be checked - insufficient memory"
"252"="Errors were found and some were not fixed"
"254"="Check was canceled"
"255"="Check was stopped because of an error"
;This section is where the drives and options selected in the Task Scheduler Settings button are stored. The settings are the same as the table above. Set0 is the first Scandisk task in Task Scheduler, Set1 is the second, ect.
[HKEY_LOCAL_MACHINE\Software\Microsoft\Plus!\SystemAgent\SAGE\Scandisk for Windows\Set0]
"Settings"=hex:31,02,40,61
"DrivesToCheck"=hex:04,00,00,80
Batch files can also use these codes. Scandisk returns the same error codes. If running Scandskw use.
;Start /w scandskw <command line parameters fom table above eg /all /non /nosummary>or if running scandisk use
;scandisk <command line parameters fom table above eg /all /autofix /nosummary>and on the following line use this test. The second errorlevel test should always be one higher than the first.
If errorlevel 1 if not errorlevel 2 echo Errors found and all were fixed