Computing.Net > Forums > Disk Operating System > a batch file that runs only once on a ce

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

a batch file that runs only once on a ce

Reply to Message Icon

Name: thomas
Date: August 17, 2001 at 08:36:52 Pacific
Comment:

I'm am wanting to know if anyone knows how to write a batch file that will check the pc to see what day it is(ex. Mon.Tues.Wed, etc.)and if it is that day then call another batch to run, but if it is not that specific day then exit. Also on the specified day once the batch file has ran the secondary batch once I don't want it to run that batch again. If anyone can help I would appreciate it.



Sponsored Link
Ads by Google

Response Number 1
Name: Grant
Date: August 17, 2001 at 20:01:56 Pacific
Reply:

Thomas, try something along the lines of this.
ECHO. | DATE | FIND "Fri" > nul
IF NOT ERRORLEVEL 1 CALL BATCH.BAT
If you want to delete the batch file that is called on the day, you will need to test in the calling batch file. This is because you can not delete an Open, running, file. So you would have lines like the ones above except you would DEL BATCH.BAT insted of callingit.

Where as on the other hand if you want to delete the calling batch file you will have to do it from the called batch file. Same reason as above.

If you have questions email me, drscriptt@yahoo.com, and I'll try to give you more info.


0

Response Number 2
Name: Grant
Date: August 17, 2001 at 20:03:42 Pacific
Reply:

Oh, yah, DOS does not have a native way to schedule tasks in the background. You will have to turn to some 3rd party, non-MS-DOS, solution. I have used Task Scheduler with much success.


0

Response Number 3
Name: Secret_Doom
Date: August 18, 2001 at 17:34:28 Pacific
Reply:

Oh, well... DOS hasn't NATIVE schedulers, that's why we are meant to make them =D

This should solve your problem:

@echo off
echo. |date |find /i "FRI" > nul
if errorlevel=1 goto nottoday
if exist c:\check.dat goto end
call batch.bat
rem > c:\check.dat
goto end
:nottoday
if exist c:\check.dat del c:\check.dat
:end

That will create a temporary file c:\check.dat. Leave it alone (you can change it's location by the batch)

Any further question, letme know!

-- Secret_Doom --

secret_doom@hotmail.com
secretdoom.hpg.com.br

PS: There is a little chance that one day the batch doesn't call the second one. That will happen only if you boot once in friday, don't boot for the whole week and then do only boot in the next friday.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Pesky memory error Time to FPROT your tarbal...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: a batch file that runs only once on a ce

How do u make a batch file that runs whenever the computer boots up www.computing.net/answers/dos/how-do-u-make-a-batch-file-that-runs-whenever-the-computer-boots-up/3744.html

read a file from a batch file??? www.computing.net/answers/dos/read-a-file-from-a-batch-file/16657.html

Batch file to run on log off! www.computing.net/answers/dos/batch-file-to-run-on-log-off/14751.html