Jump to content

Recommended Posts

Guest WORLDe
Posted

Some questions about batch files…..

 

So, I have a batch file called batch1.bat.

 

Within that batch file, I have 5 commands that kick off different reports

from our ERP app..

 

I would like to be able to tell the batch file this:

If it is 2am on Monday, kick off report 1, but don’t touch the others.

If it is 3 am on Tuesday, kick off report 2, but don’t touch the others.

 

If this is possible, how would i script this out?

  • Replies 1
  • Created
  • Last Reply

Popular Days

Guest Pegasus \(MVP\)
Posted

Re: Batch files

 

 

"WORLDe" <WORLDe@discussions.microsoft.com> wrote in message

news:B2675E81-ADC7-4995-9161-EDDF91CD330B@microsoft.com...

> Some questions about batch files...

>

> So, I have a batch file called batch1.bat.

>

> Within that batch file, I have 5 commands that kick off different reports

> from our ERP app..

>

> I would like to be able to tell the batch file this:

> If it is 2am on Monday, kick off report 1, but don't touch the others.

> If it is 3 am on Tuesday, kick off report 2, but don't touch the others.

>

> If this is possible, how would i script this out?

 

You could try this:

@echo off

set Hour=%time:~0,2%

set DOW=%date:~0,3%

if /i %DOW%==Mon if %Hour%= 2 goto Report1

if /i %DOW%==Tue if %Hour%= 3 goto Report2

if ...

goto :eof

 

:Report1

[do something]

goto :eof

 

:Report2

[do something else]

goto :eof

 

You may need to tweak the "if" statement to suit your

particular time format (leading/no leading zeros, 12/24

hour clock).


×
×
  • Create New...