View Full Version : DOS Autoexec.bat file

01-17-02, 06:39 PM
for anyone who knows alot about batch files, i have a question. Is there a way to program a certain dos app to execute via autoexec.bat (every bootup) on a scheduled basis (such as the 1st of each month)? is there some "if" statement that can use a date as the variable to execute my particular program? If a DOS pro knows how to schedule dos applications in this type of manner, i'd like to know, cuz i have some dos utilities i like to run, but take too long to do each bootup, and i don't want to merely do something like this as it is kind of annoying:

echo skipping optimzation...
goto skip
c:\diag\program.exe /switch
other stuff here

to execute the program, i have to add an REM to goto skip, but i want to find an automated alternative ;-)

01-17-02, 06:54 PM
There are other ways to achieve the same thing that would be easier.

You could have the autoexec.bat call another batch file instead of having the calls in the autoexec.bat itself. You could schedule the other .bat file to be renamed to some other name and then renamed to orig name on the first of each month by windows scheduler and another bat file that does the name change.

If the call to the other bat file in autoexec.bat can't find the other bat file of "orig" name it will just move on to the next instruction in the script.

01-26-02, 10:27 AM
If you any good at programming, you can write a small program that will check the date and return a value to the system.
In C this would be a return statement in the main() function.

You the use IF ERRORLEVEL 1 to check what the application returned.
I'm a bit rusty in using IF in batch files

02-20-02, 04:03 PM
Yeah, the only time I actually learned how to use those ERRORLEVEL statements was when I broke down the installation batch for Doom. Heh, it had a question to cancel or continue with the install, so I just looked off of that.... But you won't see too much of a demand for that kind of stuff anymore...