PCbanter

PCbanter (http://www.pcbanter.net/index.php)
-   Windows XP Help and Support (http://www.pcbanter.net/forumdisplay.php?f=15)
-   -   Help with Windows script (http://www.pcbanter.net/showthread.php?t=1110793)

[email protected] August 5th 20 05:17 PM

Help with Windows script
 
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.

JJ[_11_] August 6th 20 04:23 PM

Help with Windows script
 
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 ...

Ivan Denisovich August 14th 20 04:19 PM

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!


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2006 PCbanter
Comments are property of their posters