SoFunction
Updated on 2025-03-10

Custom vbs scripts to implement the method of delaying startup of specified programs after startup

Overview

When the system is powered on, many drivers are automatically started, making the mouse stagnant for a long time after the computer is powered on. In order to speed up the startup speed of Windows, after referring to many big-name information on the Internet, we sorted out the method of using vbs scripts to delay startup programs after booting.

VBS content example:

Copy the codeThe code is as follows:

Dim delayer
Set delayer = CreateObject("")
8000
"""C:\Program Files(x86)\Kingsoft\Klive\""", 0, FALSE
Set delayer = Nothing

VBS example statement analysis

The #1#2#5#6 statement does some variable declaration, initialization and aftermath work.
Statement #3: "8000"; where 8000 marks the delay time, 8000 in milliseconds means delay 8 seconds;
#4 statement: """C:\Program Files (x86)\Kingsoft\Klive\""",0, FALSE;
The key to this statement is that the Run function [3] has three parameters:
The first parameter: is the position where the program is started. Pay special attention: If there are spaces in the position, you need to use three double quotes as above.
The second parameter: The available values ​​are 0~10, and the meaning of each number is as follows:
0 Hide one window and activate another window.
1 Activate and display the window. If the window is in a minimized or maximized state, the system restores it to its original size and position. The application should specify this flag when the window is displayed for the first time.
2 Activate the window and display it as a minimized window.
3 Activate the window and display it as a maximized window.
4 Display the window by the nearest window size and position. The active window remains active.
5 Activate the window and display it by its current size and position.
6 Minimize the specified window and activate the next top window in Z order.
7 Display the window as a minimized window. The active window remains active.
8 Display the window as its current status. The active window remains active.
9 Activate and display the window. If the window is in a minimized or maximized state, the system restores it to its original size and position. The application should specify this flag when restoring the minimization window.
10 Set the display status according to the program status of the startup application.
The third parameter indicates whether the script is waiting or continuing to execute. If set to true, the script will wait for the called program to exit before executing. If it is FALSE, the next statement will be executed without waiting for the program to return.

Custom vbs scripts

Through the above example analysis [2], I believe I should understand the writing of vbs scripts!
It's actually very simple. You just need to add the copy example and add custom Sleep time and Run program statements in the middle.
By the way, netizens with weak computer knowledge can press Win+R and enter the msconfig command in the box. In the "Start" option box, check which programs are started on the computer, cancel the check box, and then write the corresponding program name and location to the delayed startup vbs script.
After writing the vbs script file, put it in the "Startup" folder and let its vbs script run on and on. Hurry up and experience the quick boot, it's cool! ! !

Some problems and solutions

However, during this process, I personally encountered a problem: the antivirus software on my computer is Kingsoft Antivirus. If you use the above method to start, the main interface of Kingsoft Antivirus will pop up when starting Kingsoft Antivirus. I am a little unhappy (forgive me). I just hope Kingsoft Antivirus can stay quietly in the system pallet after starting it by itself.

What to do?

When I used msconfig to view the Kingsoft Antivirus startup item, I found that the command it started is not just the program location, but also a parameter behind it -autorun. I immediately understood that the running program of Kingsoft Antivirus uses the –autorun parameter to achieve no main interface when booting, but only palletized.

However, the Run function cannot pass parameters to the started program, so what should I do?

At this time, I thought of the "shortcut". When you create a shortcut for an exe file, right-click the -" property box to pop up with a "target" in the "shortcut" tab, which corresponds to the location of the target file. You can pass parameters at this place.

Take my Kingsoft Antivirus as an example, its target position is: "D:\Program Files(x86)\kingsoft\kingsoft antivirus\",
The corresponding value in the target item in its shortcut property is: "D:\Program Files(x86)\kingsoft\kingsoft antivirus\".
Pass parameters to it and change the target item to: "D:\Program Files(x86)\kingsoft\kingsoft antivirus\" –autorun.
Then change the first parameter of the Run function in vbs to the position of the shortcut, so that the parameters can be passed indirectly.