在inno setup中安装之前运行powershell脚本或白名单安装目录

问题描述 投票:0回答:1

我正在使用inno setup,用户可以选择安装软件.exe的目录。

但目前在安装过程中,Windows Defender 会删除/隔离该 exe 文件,因为它认为它是病毒。 我当前的修复方法是创建一个文件夹,在 Defender 中将该文件夹列入白名单,然后运行安装程序并手动安装到该文件夹。

有没有办法在 Inno Setup 中自动执行此过程,在用户选择安装目录后,它会在安装之前将该文件夹列入白名单?

我看到一些人运行 Powershell 脚本,但是如何在 Inno setup 创建文件夹之后、安装 .exe 之前运行此脚本?

powershell installation inno-setup antivirus windows-defender
1个回答
0
投票

假设您使用

Dirs
部分条目创建目录,请使用
AfterInstall
参数
调整自定义代码以执行 PowerShell:

[Dirs]
Name: "{app}\data"; AfterInstall: AfterDirectoryCreated
[Code]

procedure AfterDirectoryCreated;
var
  ResultCode: Integer;
begin
  if Exec('powershell', Params, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
  begin
    Log('PowerShell executed successfully');
  end
    else
  begin
    Log('PowerShell failed to execute');
  end;
end;

尽管更改用户防病毒设置在我看来是不可接受的安全漏洞。修复您的应用程序,使其不被检测为病毒。

© www.soinside.com 2019 - 2024. All rights reserved.