【Startup】Win11 startup software, win11 startup bat script (startup vbs file)

edit bat script

brief introduction

  • ::is the comment prefix
  • echois to output the content to the console, which is equivalent to print
  • @echo off可以关闭路径显示,自己尝试写和不写就行
  • timeout /t numnum means write a number, sleep for num seconds, the unit is seconds
  • echo,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 software
  • exitIndicates 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\Startupthis directory.
insert image description here
Then you can restart the test.

Guess you like

Origin blog.csdn.net/NineWaited/article/details/128758263