簡體   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