Getting a shortcut on the start screen from installer in Windows 8.1 (NSIS)

孤者浪人 提交于 2020-01-04 13:58:08

问题


I'm guessing this answer exists somewhere but I've been searching and trying things for 8+ hours now so I'm asking.

How do I get an icon on the Windows 8.1 (and 8, and 7) start screen at installation time?

I'm using Nullsoft Scriptable Install System. I've tried both version 2.46 and 3.0b0 (not that I thought that had anything to do with it but might as well try both).

What I think is the relevant part of my script is this

!define APPNAME "MyApp"
!define COMPANYNAME "Greggman"

SetShellVarContext current
CreateDirectory "$STARTMENU\Programs\${COMPANYNAME}"
CreateShortCut "$STARTMENU\Programs\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\myapp.exe" "$\"$INSTDIR\somedir\somescript.foo$\" --app-mode" "$INSTDIR\logo.ico"
CreateShortCut "$STARTMENU\Programs\${COMPANYNAME\${APPNAME}-Uninstall.lnk" "$INSTDIR\uninstall.exe"        createDirectory "$SMPROGRAMS\${COMPANYNAME}"

It creates a shortcut but it's only visible on the all apps screen (or whatever that's called)

There's nothing on the start screen

Maybe that's the way it should be but it's hard for me to believe the average user is going to know they either have to search for the app they just installed or else they have to click that tiny arrow in the bottom left of the start screen and then find the "greggman" section among all those tiny icons, then then click MyApp to run the thing they just installed.

I've also tried both HKLM with admin rights and HKCR with only user rights. I'd prefer to stick to HKCR but since it didn't work in either case I don't think that's the issue.

Where do I put shortcuts or registry settings or whatever to add a tile to the start screen. Or is there some other thing I should do so my users can find MyApp after they've installed it?


回答1:


Windows 8 will pin your shortcuts to the Start Screen, (ALL of your shortcuts if the flag discussed above isn't set - on a per-shortcut basis). On Windows 8.1, only the USER can pin shortcuts, and they have to do it manually. The change was made because users complained their Start Screens were getting too cluttered.




回答2:


Windows is supposed to pin it for you. This pinning can be controlled by System.AppUserModel.StartPinOption.

CreateShortcut "$SMPrograms\MyApp.lnk" "$InstDir\MyApp.exe" should be enough. You are not really supposed to create links to the uninstaller/readme/help files in the start menu and if after removing those you are left with a single shortcut then you should not create a subfolder either. I'm not sure if that is part of the problem.



来源:https://stackoverflow.com/questions/25054159/getting-a-shortcut-on-the-start-screen-from-installer-in-windows-8-1-nsis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!