如何在系统启动时运行exe - 不使用启动文件夹或任务调度程序

时间:2017-07-12 06:50:29

标签: vb.net

Dim wshShell As New WshShellClass()
Dim shortcut As IWshRuntimeLibrary.IWshShortcut
Dim startUpFolderPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup)

' Create the shortcut
shortcut = DirectCast(wshShell.CreateShortcut((startUpFolderPath & Convert.ToString("\")) + Application.ProductName + ".lnk"), IWshRuntimeLibrary.IWshShortcut)

shortcut.TargetPath = Application.ExecutablePath
shortcut.WorkingDirectory = Application.StartupPath
'shortcut.Description = "Launch My Application"
'shortcut.IconLocation = Application.StartupPath + @"\App.ico";
shortcut.Save()

0 个答案:

没有答案