繁体   English   中英

如何将快捷方式固定到NSIS的开始菜单?

[英]How to pin shortcut to start menu with NSIS?

我有一个NSIS安装程序脚本,该脚本调用CreateShortcut将条目添加到开始菜单。 但是,我想在新创建的快捷方式中将选项设置为“固定到开始菜单”。

这可能吗? 我已经看到了一些有关如何执行此操作的VBScript示例 ..那是我对NSIS的唯一选择,还是有更好的方法?

Windows 8应该自动为您固定它, 而8.1不会

虽然可以模拟固定快捷方式, 但实际上没有这样做

如果您想作恶而不遵循指南,可以使用此插件 ...

使用StdUtils插件的InvokeShellVerb函数可以做到这一点。

适用于Windows 7及更高版本。

这是为后代保留的示例 ...

!include 'StdUtils.nsh'

RequestExecutionLevel user ;no elevation needed for this test
ShowInstDetails show

Section
    IfFileExists "$SYSDIR\mspaint.exe" +3
    MessageBox MB_ICONSTOP 'File does not exist:$\n"$SYSDIR\mspaint.exe"$\n$\nExample cannot run!'
    Quit
SectionEnd

Section
    DetailPrint "Going to pin MSPaint..."
    ${StdUtils.InvokeShellVerb} $0 "$SYSDIR" "mspaint.exe" ${StdUtils.Const.ShellVerb.PinToTaskbar}
    DetailPrint "Result: $0"

    StrCmp "$0" "ok" 0 +3
    MessageBox MB_TOPMOST "Paint should have been pinned to Taskbar now!"
    Goto +2
    MessageBox MB_TOPMOST "Failed to pin, see log for details!"
SectionEnd

Section
    DetailPrint "Going to un-pin MSPaint..."
    ${StdUtils.InvokeShellVerb} $0 "$SYSDIR" "mspaint.exe" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
    DetailPrint "Result: $0"

    StrCmp "$0" "ok" 0 +3
    MessageBox MB_TOPMOST "Paint should have been un-pinned from Taskbar now!"
    Goto +2
    MessageBox MB_TOPMOST "Failed to un-pin, see log for details!"
SectionEnd    

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM