向Windows中添加自启动程序

来源:互联网 发布:二战后的英国知乎 编辑:程序博客网 时间:2024/05/21 19:24

AddAutoRunProgram.vbs


假设该程序在c:/myfile文件夹中,文件名为autorun.exe


Dim AutoRunProgram
Set AutoRunProgram=WScript.CreateObject("WScript.Shell")
RegPath="HKLM/Software/Microsoft/ Windows/CurrentVersion/Run/"
Type_Name="REG_SZ"
Key_Name="AutoRun"
Key_Data="C:/Myfile/autorun.exe"

该自启动程序的全路径文件名
AutoRunProgram.Write RegPath&Key_Name,Key_Data,Type_Name
在启动组中添加自启动程序autorun.exe
MsgBox("Success!")