Table of contents
edit bat script
brief introduction
::
is the comment prefixecho
is to output the content to the console, which is equivalent to print@echo off可以关闭路径显示,自己尝试写和不写就行
timeout /t num
num means write a number, sleep for num seconds, the unit is secondsecho,
Directly followed by a comma can directly break the line, which is equivalent to println()start 软件的exe路径
Use the start command to open a certain softwareexit
Indicates to exit the command window
:: @echo off可以关闭比pwd路径与指令显示
@echo off
echo 10秒后启动steam...
timeout /t 10
:: 启动steam
echo .
echo 正在启动steam....
start D:\steam.exe
echo .
:: 30s超时等待steam启动成功
echo 等待steam启动成功...
timeout /t 40
echo .
:: 启动小猫
echo 正在启动xxx...
start D:\xxxx.exe
echo .
exit
After writing the bat script, double-click to run it to test whether the command effect of the script meets expectations.
edit vbs script
# bat脚本路径写自己的,其他照抄。
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "D:\xxxx\test.bat /start",0
Let the vbs script start at boot
The bat script cannot be started directly on boot, but vbs can.
Put the vbs file in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
this directory.
Then you can restart the test.