|
-
January 27th, 2001, 07:35 PM
#1
batch scripts like cron jobs
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?
-
January 28th, 2001, 02:22 AM
#2
Everything you ever wanted to know bout batch files:
http://www.cableyorkton.com/users/gbraun/batch/
murf
Please do not use "PM" for personal help, post in forum so everybody can learn
-
January 28th, 2001, 12:14 PM
#3
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 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]
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
Instructions:
[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
[*]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)
[*]Click the Advanced button and select Notify me if the program never started
[*]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.
-
January 28th, 2001, 03:25 PM
#4
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.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|