Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get a VB script to run on a particular day? 2

Status
Not open for further replies.

ukkcbeard

Technical User
Mar 10, 2005
14
0
0
GB
Hi All,
I have a VB script I need to run on a customer network to clear out temp files, I have the script together however what I need is lines in the script to check the system date and if the date is either the 14th or the 28th of the month then to continue processing. Any other day the script should exit.

The customer does not want to use scheduled tasks hence i need it in the script itself.

Cheers
 
Have a look at the Day function:
Code:
Id Day(Date) Mod 14 <> 0 Then WScript.Quit

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OOps, sorry for the typo:
Code:
If Day(Date) Mod 14 <> 0 Then WScript.Quit

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Genius!! Thanks very much....:) Works a treat! If I wanted to add the 28th (So it runs twice a month) how would I record that?

Cheers
 
The script will cope with the 28th 'as is' (because it does a check on the remainder of (day number of the date)/14, which will equal 0 on either 14th or 28th and won't quit the script).

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top