From 904c499df7b4236eb263b099af6f172bdcf304fc Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Tue, 2 Dec 2025 19:04:17 +0300 Subject: [PATCH] Update SFX.ps1 --- Scripts/SFX.ps1 | 16 ++-------------- Scripts/SFX_config.txt | 8 ++++++++ 2 files changed, 10 insertions(+), 14 deletions(-) create mode 100644 Scripts/SFX_config.txt diff --git a/Scripts/SFX.ps1 b/Scripts/SFX.ps1 index d529c448..eac3036b 100644 --- a/Scripts/SFX.ps1 +++ b/Scripts/SFX.ps1 @@ -21,19 +21,7 @@ $Parameters = @{ } $Latest_Release_Windows_11_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 -# Create config -@" -; Expand SFX archive -Path=$env:TEMP\Sophia_Script_for_Windows_11_v$($Latest_Release_Windows_11_PowerShell_5_1) -; Copy folder recursively to user's Desktop folder -Setup=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -Command & {Copy-Item -Path "$env:TEMP\Sophia_Script_for_Windows_11_v$($Latest_Release_Windows_11_PowerShell_5_1)" -Destination '$(Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop)\1' -Recurse -Force} -; No GUI while expanding SFX archive -Silent=1 -"@ | Set-Content -Path config.txt -Encoding Default -Force - -get-content config.txt - -Write-Verbose -Message "$(Get-ItemPropertyValue -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' -Name Desktop)\1" -Verbose +(Get-Content -Path Scripts\SFX_config.txt -Encoding utf8NoBOM -Raw) | Foreach-Object -Process {$_ -replace "SophiaScriptVersion", $Latest_Release_Windows_11_PowerShell_5_1} | Set-Content -Path Scripts\SFX_config.txt -Encoding utf8NoBOM -Force # Create SFX archive -& "C:\Program Files\WinRAR\Rar.exe" a -sfx -z"config.txt" -ep1 -r "SophiaScriptWinGet_SophiaScriptVersion.exe" "Sophia_Script_for_Windows_11_v$($Latest_Release_Windows_11_PowerShell_5_1)\*" +& "C:\Program Files\WinRAR\Rar.exe" a -sfx -z"Scripts\SFX_config.txt" -ep1 -r "SophiaScriptWinGet_SophiaScriptVersion.exe" "Sophia_Script_for_Windows_11_v$($Latest_Release_Windows_11_PowerShell_5_1)\*" diff --git a/Scripts/SFX_config.txt b/Scripts/SFX_config.txt new file mode 100644 index 00000000..88810bd4 --- /dev/null +++ b/Scripts/SFX_config.txt @@ -0,0 +1,8 @@ +; Config for creating a WinRAR SFX archive for WinGet + +; Expand SFX archive +Path=$env:TEMP\Sophia_Script_for_Windows_11_vSophiaScriptVersion +; Copy folder recursively to user's Desktop folder +Setup=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -Command & {Copy-Item -Path "$env:TEMP\Sophia_Script_for_Windows_11_vSophiaScriptVersion" -Destination "$(Get-ItemPropertyValue -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' -Name Desktop)\Sophia_Script_for_Windows_11_vSophiaScriptVersion" -Recurse -Force} +; No GUI while expaning SFX archive +Silent=1