在我的安装应用程序中找到:
通过快捷方式访问访问应用程序安装程序我使用此代码为用户生成快捷方式。 在我的安装程序应用程序中,我将其设置为在用户桌面以及用户“程序”文件夹(单击“开始”->“程序”进入该文件夹)中创建快捷方式。
Public Sub Create_ShortCut(ByVal TargetPath As String, ByVal ShortCutPath As String, ByVal ShortCutname As String, Optional ByVal WorkPath As String, Optional ByVal Window_Style As Integer, Optional ByVal ShortcutLetter As String)
'Create a Windows Script Host Object
Dim objWSHShell As Object
Set objWSHShell = CreateObject("WScript.Shell")
'Create shortcut
Dim MyShortcut As Object
ShortCutPath = objWSHShell.SpecialFolders(ShortCutPath & "")
Set MyShortcut = objWSHShell.CreateShortcut(ShortCutPath & "\" & ShortCutname & ".lnk")
MyShortcut.TargetPath = TargetPath
MyShortcut.WorkingDirectory = WorkPath
MyShortcut.WindowStyle = Window_Style
If strIconFullPath <> "" Then
MyShortcut.IconLocation = strIconFullPath
End If
If ShortcutLetter <> "" And Len(ShortcutLetter) = 1 Then
MyShortcut.hotkey = "Ctrl+ALT+" & ShortcutLetter
End If
MyShortcut.Save
'cleanup
Set MyShortcut = Nothing
Set objWSHShell = Nothing
End Sub
From: https://bytes.com/topic/access/insights/933856-create-shortcut-your-application-automatically
本文介绍了一种使用VBScript在Windows环境下自动为应用程序创建桌面及程序文件夹内快捷方式的方法。通过提供的代码示例,读者可以了解到如何利用Windows Script Host对象创建目标路径的快捷方式,并设置工作目录、窗口样式等属性。
2387

被折叠的 条评论
为什么被折叠?



