home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
utility
/
pbaseiv.zip
/
P4DOS004.TIP
< prev
next >
Wrap
Text File
|
1991-12-16
|
3KB
|
75 lines
Due to unruly applications, inexperienced users who share my
PC, and a hard disk that's full to overflowing, I have to
run CHKDSK frequently. However, I don't want to review the
results of the check unless there's a problem. I therefore
use a sequence of batch commands below to keep
CHKDSK in the background--unless it finds something
important.
The batch works because the DOS COPY command won't copy
zero-length files--a quirk I've often found useful in
conjunction with the FIND filter.
Jim White
Fargo, North Dakota
Editor's note: Mr. White's batch routine uses some clever
tricks to do its job. After writing the results of a CHKDSK
to a file (instead of the screen), the batch uses the FIND
command three times to search this file for warning phrases
that CHKDSK might have written, sending the results to three
new files. If FIND doesn't find anything--in other words, if
CHKDSK found no problems--all three FIND-created files will
be empty. Since COPY won't work on a zero-length file,
CHK.$$5 won't be created, and a simple `if not exist...go
to' statement will direct your batch file elsewhere.
This technique can be used in any batch where you want to
perform a specific action if the FIND command found
something--or didn't. This lets you monitor the output of
many DOS utilities, including CHKDSK, ATTRIB, and DIR, for
lines that indicate your system requires attention. To run
CHKDSK every day without being bothered with the results,
put White's commands--or something like them--into your
AUTOEXEC.BAT file. And if you have a RAM disk, you can speed
up your batch by writing all those temporary files to it.
You can copy the listing to a file with the Alt-F key and
customize it for your own use.
Postscript: When this batch was originally published, a
few readers reported that it sometimes "hung up" when used
to test a disk. We traced this problem to CHKDSK's "lost
clusters" report. Most versions of CHKDSK stop and ask you
if you want to convert lost clusters to files even when you
have not specified the /F parameter (required for fixes to
be made)!
The solution was to use the echo command to send a "y" to
CHKDSK, just in case it required a response. The listing
below reflects that change.
Reporting CHKDSK errors
---- BEGIN LISTING ----
@echo off
echo Checking for disk problems....
if exist c:\tmp\chk.$* del c:\tmp\chk.$*
chkdsk < echo y> c:\tmp\chk.$1
find "non-contiguous" < c:\tmp\chk.$1 > c:\tmp\chk.$$2
find "lost clusters" < c:\tmp\chk.$1 > c:\tmp\chk.$$3
find "cross-linked" < c:\tmp\chk.$1 > c:\tmp\chk.$$4
copy c:\tmp\chk.$$? c:\tmp\chk.$5 > nul
if not exist c:\tmp\chk.$5 goto continue
echo CHKDSK reports potential problems:
more < chk.$1
pause
:continue
del c:\tmp\chk.$*
---- END LISTING ----
Title: Checking Up on CHKDSK
Category: DOS
Issue date: Nov 1991
Editor: Brett Glass
Supplementary files: NONE