簡體   English   中英

打開Powershell窗口后,SFX安裝程序無法運行Powershell腳本

[英]SFX installer fails to run powershell script after powershell window is opened

我正在最新的Windows 10中創建一個7zip sfx安裝程序,該程序有望運行Powershell腳本。 提取完成后,將顯示Powershell窗口,但無需執行腳本即可快速關閉。

任何幫助深表感謝!

我嘗試使用自簽名證書對腳本文件和installer.exe本身進行簽名,但是沒有運氣。

我已將所有問題排查范圍的Powershell ExecutionPolicy更改為Unrestricted,但也沒有運氣

我在sysinternals中使用進程監視器捕獲powershell.exe行為,發現在讀寫c:\\ Users \\ xxx \\ AppData \\ Local \\ Microsoft \\ Windows \\ PowerShell \\ StartupProfileData-Interactive之后,powershell開始退出線程

這是我的7zip sfx的config.txt:

;!@Install@!UTF-8!
Title="Cloud API"
BeginPrompt="Do you want to install Cloud API?"
RunProgram="powershell.exe -NoExit –NoProfile -ExecutionPolicy Bypass -File %%T\\cloud_api\\installer.PS1"
Directory="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\"
;!@InstallEnd@!

我通過以下方式壓縮python中的文件:

..\\7zr a -sfx7zSD.sfx cloud-api.7z .\\cloud-api -r -y

我期望解壓縮后將執行installer.PS1,但僅運行powershell.exe並迅速退出而根本不運行腳本。

解決此問題的第一步是在7zip配置中聲明.ps1腳本的完整路徑。 這將確保您正在調用要啟動的腳本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM