General discussion


automating chkdsk & dfrg

By dpchris ·
I implemented a script I downloaded from techrepublic called Anyways, the document talks about being able to automate the script with XP's Task Scheduler.

I found that if I don't run the command script from the dos shell, it doesn't appear to run at all. Is there a work around this? The script is as follows:

REM chkdsk and defrag automation
for /F "eol= tokens=1 delims=( " %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk

If %DrvLtr% == end goto :eof
chkdsk %DrvLtr%
If not errorlevel 3 goto :defrag
If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon

echo Y chkdsk /F /R
goto :defrag

chkdsk %DrvLtr% /F /R

defrag %DrvLtr% -b
defrag %DrvLtr%

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

May need to lead XP by the hand

by mpage In reply to automating chkdsk & dfrg

When you set up your scheduled task, you may need to schedule the Command Interpreter to run, and designate this .CMD file as th file to execute.

First go through the task creation wizard, browse to CMD and set up your schedule. The right click on the properties of your event and add the filename and path to the end of CMD.EXE.

It would look something like:

c:\windows\system32\cmd.exe /windows\system32\config\batch\chkdefragdsk.cmd

Keep in mind if there are spaces in the pathname to your CMD file you need to wrap the whole thing in quotes. Save it and you should be golden.

Matthew M Page
Scholle Corp, Network Services

Collapse -

missing DrvLtr.txt file full details at...

by bradagreen In reply to automating chkdsk & dfrg

Go to:

Collapse -

It can't lock the drive

by kwells1014 In reply to automating chkdsk & dfrg

I tried this script also, and when it didn't seem to work, I tried the command interactively. The message I get says it can't lock the drive and asks if I want to reschedule this for the next startup. Needless to say, the script doesn't finish.

Back to Desktop Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums