[英]How do i change the start in path of a shortcut for nsis?
I have an nsis installer script for the application im working on and it can place a shortcut on the desktop and in the start menu folder but each shortcut has the wrong start in path and as such the app saves data files to where the short cut is.我有一个用于我正在处理的应用程序的 nsis 安装程序脚本,它可以在桌面和开始菜单文件夹中放置一个快捷方式,但每个快捷方式的路径开头都是错误的,因此应用程序将数据文件保存到快捷方式所在的位置.
Is there an easy way to change the start in path as the documentation was less than helpful on the matter?由于文档对此事的帮助不大,是否有一种简单的方法可以更改路径的开始?
Section "Desktop Shortcut" SHORTCUT
SetOutPath "$DESKTOP"
CreateShortcut "${FULL_APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" "" "$ICONDIR\${DESKICO}"
SectionEnd
Please see the following page of the NSIS documentation: 请参阅NSIS文档的以下页面:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4 http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4
In particular, please look at the sentence that reads: 请特别注意以下句子:
"$OUTDIR is used for the working directory. You can change it by using SetOutPath before creating the Shortcut." “$ OUTDIR用于工作目录。您可以在创建快捷方式之前使用SetOutPath更改它。”
In other words, you need to use 'SetOutPath' to specify the "Start In" folder for the shortcut. 换句话说,您需要使用“SetOutPath”为快捷方式指定“Start In”文件夹。 This is why the solution posted by Zerofiz works: 这就是Zerofiz发布的解决方案的工作原理:
Section "Desktop Shortcut" SHORTCUT
SetOutPath "$INSTDIR"
CreateShortcut "$DESKTOP\${FULL_APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" "" "$ICONDIR\${DESKICO}"
SectionEnd
This will cause the shortcut to start in $INSTDIR. 这将导致快捷方式以$ INSTDIR开头。
Try this: 试试这个:
Section "Desktop Shortcut" SHORTCUT
SetOutPath "$INSTDIR"
CreateShortcut "$DESKTOP\${FULL_APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" "" "$ICONDIR\${DESKICO}"
SectionEnd
Note: if you just want the "Start in:" field to be blank, you can also use the /NoWorkingDir
flag mentioned in the link to the documentation.注意:如果您只想将“开始于:”字段留空,您还可以使用文档链接中提到的/NoWorkingDir
标志。 http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4 http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4
Section "Desktop Shortcut" SHORTCUT
SetOutPath "$INSTDIR"
CreateShortcut /NoWorkingDir "$DESKTOP\${FULL_APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" "" "$ICONDIR\${DESKICO}"
SectionEnd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.