我有一个NSIS安装程序脚本,它调用CreateShortcut
在开始菜单中添加一个条目。但是,我想在新创建的快捷方式中将选项设置为“固定到开始菜单”。
这可能吗?我已经看到一些VBScript examples如何做到这一点..这是我对NSIS的唯一选择,还是有更好的方法?
答案 0 :(得分:1)
Windows 8应该为您while 8.1 will not自动固定它。
虽然可以模拟固定快捷方式not really supposed to do it。
如果您想成为邪恶而不遵循指导原则,可以使用this plugin ...
答案 1 :(得分:0)
使用InvokeShellVerb
插件的StdUtils
功能可以实现这一点。
适用于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