Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9010825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:33:56+00:00 2026-06-16T02:33:56+00:00

I need to run a vbs script at login that will run a batch

  • 0

I need to run a vbs script at login that will run a batch script based on a time range of between 22:00 and 06:00 the following day.

I have the current script as follows

If Hour(Now()) >= 20 AND hour(Now()) < 6 Then
   //RUN SCRIPT
Else
   //RUN OTHER SCRIPT
End If

Now the script runs fine when I use pre noon times e.g 6 and 11 but the about it does not. I can see the issue in that is is not factoring in the following days time and actually going back in time. What I need is the following

if time is 20:00 on day 1 but less than 06:00 on day 2 run the script else run the other script

This needs to run continuously between these times for every day of the week.

Please can you help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:33:57+00:00Added an answer on June 16, 2026 at 2:33 am

    Why not just change AND to OR? In that case when the hour of the day is greater than 20 then it will fire. if the hour of the day is less than 6 it will also fire. Look at it less of the time frame when it needs to fire and more of a time frame excluding those hours when it does not need to fire.

    If Hour(Now()) >= 20 OR hour(Now()) < 6 Then
       //RUN SCRIPT
    Else
       //RUN OTHER SCRIPT
    End If
    

    VB Script Date Functions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a VBS script which I need to run on a monthly basis
I need to run a script that will generate the projects.list file when a
i need run code that will create a database and populate tables. i am
I need to run the application that I have made in Xcode on my
I need to run a script and have access to the default stdin (terminal
Good afternoon, I wish to have a script that will look for all files
I need to either write a batch file or a vbscript that will rename
I have a batch script that prompts a user for some input then outputs
i have vbs file with a few command line utilities that need to be
I have a VBScript script that runs a second VBScript script. The second VBScript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.