i was wondering if anyone has tried to write a batch script that will performa certain task at a certain hour, like executing a scandisk, or cleaning the internet caché. i`m fairly new to batch scripts, is it possible to do so?
Printable View
i was wondering if anyone has tried to write a batch script that will performa certain task at a certain hour, like executing a scandisk, or cleaning the internet caché. i`m fairly new to batch scripts, is it possible to do so?
Everything you ever wanted to know bout batch files:
http://www.cableyorkton.com/users/gbraun/batch/
murf
The following is an example of how I set one up on a Windows 95 system here:
The Windows 95 System Agent (SAGE) can be used to schedule various tasks to run at different times. If SAGE is loaded on your system, you'll see a http://www.gate.net/~pweins/nowonder...s/sageicon.gif icon on your System Tray near the clock. (You'll also see it listed in Close Program as SAGE when you press [Ctrl-Alt-Del]). If it's not loaded, click Start|Run, type c:\windows\system\sage.exe and press [Enter]. We'll get back to SAGE in a moment.
The BATch file below performs the following tasks, in this order:
[list=1][*]Displays the message Deleting temporary files ...[*]Deletes all files in the c:\windows\tempor~1 folder[*]Waits until the above command is done before proceeding[*]Displays the message Launching SCANDISK ...[*]Runs SCANDISK in non-interactive mode on all hard drives (partitions)[*]Waits until the above command is done before proceeding[*]Displays the message Launching DEFRAG ...[*]Runs DEFRAG in non-interactive mode on all hard drives (partitions)[*]Waits until the above command is done before proceeding[*]Displays the message Processing complete. Closing DOS window in 5 seconds ...[*]Waits 5 seconds and then closes the DOS window[/list=a]
Instructions:Code:@echo off
echo Deleting temporary files ...
if exist c:\windows\tempor~1\*.* start /w deltree /y c:\windows\tempor~1\
echo Launching SCANDISK ...
start /w scandskw /allfixeddisks /noninteractive /silent
echo Launching DEFRAG ...
start /w defrag /all /f /detailed /noprompt
choice/c:./t:.,5/n"Processing complete. Closing DOS window in 5 seconds ..."
for %%x in (cls exit) do %%x
[list=1][*]Copy & Paste the above code into Notepad and save it as: c:\windows\scanfrag.bat
(To load Notepad, click Start|Run, type notepad and press [Enter])
[*]Double-click the SAGE icon in the System Tray
[*]Select Program|Schedule a New Program
[*]In the Program box, type c:\windows\scanfrag.bat
[*]In the Description, type Optimize all hard drives (or whatever).
[*]In the Start in: box, type c:\
[*]Leave the Run: box as Normal Window
http://www.gate.net/~pweins/nowonder/images/sage001.gif
[*]Click the When to Run button and set when you want it to run. (I have mine set to run Daily at 2:00 AM)
http://www.gate.net/~pweins/nowonder/images/sage002.gif
[*]Click the Advanced button and select Notify me if the program never started
http://www.gate.net/~pweins/nowonder/images/sage003.gif
[*]Click OK and then OK again.[/list=a]
That's it. Your SCANFRAG.BAT should start running at whatever time you've scheduled it to run, (assuming your computer is running of course).
If you'd like to test it now, right-click the description you just created in SAGE, (e.g., Optimize all hard drives), and select Run Now.
thank you very very much for the answers. not ever since i started to use a linux box, i`ve learned all the things that the computer can, or should, do at your back.
thanks both of you.