SoFunction
Updated on 2025-04-11

In Windows system, the cyclic operation of .bat/.exe and other files is realized through vbs.

In VBScript, you can use an infinite loop and pause it for a while in each iteration, and then continue execution.

1. Create a file that runs cyclically [Double-click the file to start the run]

dim a
set a=CreateObject("")
Do
##Run file, the 0 afterwards means: no running black window will pop up "E:/",0
 60000
Loop

Note:

"E:/",0: Run the file, the 0 afterward means that no running black window will pop up

60000: 60 seconds of rest, that is, the cycle is performed every minute

Code Two

Set WshShell = ("")
' Set the path of the program you want to execute
strProgramToRun = "C:\Path\To\Your\"
' Set interval time(millisecond)
intervalTime = 1000 * 60 'For example, 60 seconds
 Do While True
     ' Execute the program
     strProgramToRun, 0, False
    ' Pause the specified time
    (intervalTime)
Loop

Please replace the value of strProgramToRun with the path of the program you want to execute. The intervalTime variable defines the interval time between executions, in milliseconds.
Note: This script will run continuously until you terminate it manually.

Code Three

VBS scripts that automatically type keyboard every once in a while

set ws=createobject("") 
do 
 "{TAB}" 
 Int(6	*Rnd+1)*1000
loop

Press the TAB key every 1 to 6 seconds
That is, it can be {TAB} or {F5} to refresh the page
Define the interval of each key press
Int(6*Rnd+1)*1000
Sleep for a certain amount of time
Rnd: generates a number of [0,1)
*Int(6 Rnd+1): Generate an integer between 1-6
1s = 1000ms
Int(6 *Rnd+1)*1000: 1~6 seconds of sleep each time

2. Create a file that stops running in a loop [double-click the file to stop running]

dim WSHshell
set WSHshell = ("")
 "taskkill /im  /f ",0 ,true

Or create a file that stops running [double-click the file to stop running]

taskkill -f -t -im

Note: The bat file cannot remove the pop-up of the black window

This is the article about the implementation of loop operation of .bat/.exe and other files in Windows system through vbs. This is all about this. For more related contents of timed loop operation of vbs, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!