按键学院吧 关注:345贴子:4,074
  • 0回复贴,共1

如何添加开机自启动

只看楼主收藏回复

call 设置开机自启动()
//把这一句放进小精灵的Form1.Load里面
下面是源码,源码无任何插件
Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
Sub 设置开机自启动()
Dim FileName,ExePath,StartingPath,fso,LinkPath,FolderPath
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell=CreateObject("WScript.Shell")
a0a= space(260):GetModuleFileName NULL,a0a, 260'当前软件全路径
ExePath= fso.GetFile(a0a).path
FolderPath=WshShell.CurrentDirectory'当前文件夹路径
StartingPath=WshShell.SpecialFolders("startup")'获取自启动路径
FileName=fso.GetFile(ExePath).name'获取文件名
If (InStr(FileName, "按键精灵")>0) Then Exit Sub
LinkPath=StartingPath&"\"&FileName&".lnk"
If (fso.fileexists(LinkPath)=0 or WshShell.CreateShortcut(LinkPath).TargetPath


IP属地:广西1楼2023-01-12 09:58回复