Hi all, In need of a little help again. I have 2 already developed scripts daily.bat and weekly.bat I am struggling to write a script which will do the following: IF day NOT IN ('Saturday', 'Sunday') THEN Run daily.bat ELSIF day = 'Saturday' THEN Run daily.bat Run weekly.bat ENDIF EXIT Any help on how I do this in DOS batch script appreciated. Cheers
Download http://ww2.netnitco.net/users/cruth/cutpak13.zip you want DAYOFWK.COM from the archive. Create a new batch file, backup.bat or whatever ... all simple and should get the job done
I should add the script is not missing "if errorlevel 1 goto Sunday", this is always left as a last resort
In WinXP and some help from http://dostips.cmdtips.com/DtTipsStringManipulation.php I figured you can do the following: Code: @ECHO OFF REM.-- Prepare the Command Processor SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION set daily=,Mon,Tue,Wed,Thu,Fri,Sat, set weekly=,Sun, REM.-- Extract the day into %day% for /f %%a in ("%date%") do set day=%%a if "!daily:%day%=!" NEQ "!daily!" echo run daily.bat if "!weekly:%day%=!" NEQ "!weekly!" echo run weekly.bat Enjoy