繁体   English   中英

NSIS脚本中是否可以使用InvokeShellVerb?

[英]Is there any alternative of InvokeShellVerb in NSIS Script?

我想将快捷方式固定到Windows 10中的任务栏。脚本运行良好,但我的工具被检测为恶意软件木马。 Microsoft删除了该动词,这可能是相同的原因。 因此,有没有其他方法可以编程方式固定/取消固定任何程序。

    OutFile "C:\PinUnpinExe\PinUnpinShortcut.exe"

!include 'StdUtils.nsh'
!include FileFunc.nsh

SilentInstall silent
RequestExecutionLevel user ;no elevation needed
ShowInstDetails hide

var inputParam
Section
    ${GetParameters} $inputParam
    System::Call "kernel32::GetCurrentDirectory(i ${NSIS_MAX_STRLEN}, t .r0)"
    ${StdUtils.InvokeShellVerb} $0 "$0" "abc.exe" $inputParam
SectionEnd

该行被检测为病毒。

 ${StdUtils.InvokeShellVerb} $0 "$0" "abc.exe" $inputParam

我也同意其他语言的解决方案。

不要以编程方式固定快捷方式 ,任务栏是用户放置自己喜欢的图标的地方!

要取消固定,您可以执行以下操作(NSIS 3+):

!include "LogicLib.nsh"
!include "Win\COM.nsh"

!macro UnpinShortcut lnkpath
Push $0
Push $1
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r0 ""
${If} $0 P<> 0
    System::Call 'SHELL32::SHCreateItemFromParsingName(ws, p0, g "${IID_IShellItem}", *p0r1)' "${lnkpath}"
    ${If} $1 P<> 0
        ${IStartMenuPinnedList::RemoveFromList} $0 '(r1)'
        ${IUnknown::Release} $1 ""
    ${EndIf}
    ${IUnknown::Release} $0 ""
${EndIf}
Pop $1
Pop $0
!macroend

Section Uninstall
!insertmacro UnpinShortcut "$SMPrograms\MyApp.lnk"
SectionEnd

暂无
暂无

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

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