在NSIS Script中有InvokeShellVerb的替代方案吗?

时间:2016-06-29 07:27:57

标签: windows windows-10 nsis

我想将快捷方式固定到Windows 10中的任务栏。脚本工作正常但我的用户被检测为恶意软件木马。微软已删除动词,这可能是同样的原因。那么是否有任何替代方法以编程方式固定/取消固定任何程序。

    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

我也可以使用其他语言解决方案。

1 个答案:

答案 0 :(得分:0)

Don't programmatically pin shortcuts,任务栏为a place for users以放置自己喜欢的图标!

要取消固定,您可以执行此操作(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
相关问题