Question Locked

PC Maintenance

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I do not know how to write a script, but I am looking for a script that will run task in the background so the user will know know these task are being run.

I would like to run three task.

1. Disk Cleanup - cleanmgr.exe
2. Defrag - degrag.exe
3. Check Disk - chkdsk

7 replies

by wesley.chin

What is the OS? if it is any flavor of Windows, settng those to run via the task scheduler should do the trick easily. Else youy could have them all in a batch file to run successively and have task scheduler run the batch file. Well, if the OS is any flavor of Windows post-ME, all of that can be put in a batch, except for chkdsk, which will only run in read-only mode if the OS is running.

by vonharvin

The platform is Windows XP. I have already scheduled it in Scheduled Tasks, but it waits for a response from the operator. I am trying to find away I can automate this with out the operator knowing that it is running.

by dumphrey

in the past is set up a batch file, and run it on the LAN using pstools from sysinternals. You can use a list of ip or dns names as the target, and most programs will run with no user interaction, except chkdsk. This can be automated by the command
ECHO Y|CHKDSK /F
which will run chkdsk with repair if needed upon next reboot.

So, a sample batch file to run chkdsk, defrag, and reboot would look like

*****Script start. Copy Between * and rename with a .bat extension*******

:START
@ECHO OFF

:CHKDSK
ECHO Y|CHKDSK > c:\check.txt
findstr /C:"Windows found problems with the file system." c:\check.txt
if "%errorlevel%" == "0" goto RUNCHK
if not "%errorlevel%" == "0" GOTO CHECKDEF

:RUNCHK
ECHO Y|CHKDSK /F

:CHECKDEF
defrag -a c: > c:\Weeklytest.txt
findstr /C:"You do not need to defragment this volume." c:\Weeklytest.txt
if "%errorlevel%" == "0" goto end
if not "%errorlevel%" == "0" GOTO DFG

:DFG
defrag c:

:END
del c:\check.txt
del c:\Weeklytest.txt
shutdown -f -r

******Script End******

(Change -r to -s on shutdown to power off as opposed to rebooting, this command does not work on win 98 or win2k).

There may be a better script, but this is what I have come up with in my puttering, a programmer I am not..

EDIT: RAN across this:
http://www.bdargo.com/
Which would allow you (in theory) to comile the above batch file with a run as or as an .exe hide its self, and be scheduled by task scheduler.

by wesley.chin

You have it scheduled and when it runs, there is prompt for input?!

Are they scheduled as individual tasks or combined in a batch file?

What kind of user accounts are on the machines? If it is Limited, that may be the reason.

by assabur_razeek

i am a coputer tecnician i am working in doha qatar ineed anather any conry's good like this job.

by dumphrey

chkdsk prompts for user input if just called using just the chkdsk c: command. Hence the "echo y|chkdsk c:" in my example above.

This discussion is closed to new replies.