Help with Windows script
On Thursday, August 6, 2020 at 10:23:53 AM UTC-5, JJ wrote:
On Wed, 5 Aug 2020 09:17:54 -0700 (PDT), wrote:
I use Windows scheduler to run BAT files using the "At startup" option.
Is it possible to insert some script into the BAT file that will prevent
it from running on weekends?
If not, is there some way to accomplish this while still being able to
run at startup the rest of the time?
All help appreciated.
Make the batch file check the current day. If it's weekend, exit the batch
file (don't continue to execute its main task). Otherwise, continue as
normal.
e.g.: (note: Sunday is 1, Monday is 2, etc.)
@echo off
setlocal
echo wscript.echo datepart("w", now)"%temp%\day.vbs"
for /f %%A in ('cscript //nologo "%temp%\day.vbs"') do set d=%%A
del "%temp%\day.vbs"
if "%d%" == "7" goto :eof
rem the main task code
rem ...
Many thanks for your help, I appreciate it!
|