From 59cf2de3ac872125c93ffa4f6c2f18c8d1b1cc83 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Mon, 16 Feb 2026 16:13:24 +0300 Subject: [PATCH] Updated WinGet SFX config --- Scripts/SFX.ps1 | 17 ----------------- Scripts/SFX_config.txt | 8 -------- Scripts/WinGet_SFX.ps1 | 17 +++++++++++++++++ Scripts/WinGet_SFX_config.txt | 8 ++++++++ 4 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 Scripts/SFX.ps1 delete mode 100644 Scripts/SFX_config.txt create mode 100644 Scripts/WinGet_SFX.ps1 create mode 100644 Scripts/WinGet_SFX_config.txt diff --git a/Scripts/SFX.ps1 b/Scripts/SFX.ps1 deleted file mode 100644 index 8904b963..00000000 --- a/Scripts/SFX.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -Write-Verbose -Message SFX -Verbose - -# Install WinRAR -winget install --id RARLab.WinRAR --accept-source-agreements --force - -# Get latest version tag for Windows 11 -$Parameters = @{ - Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/sophia_script_versions.json" - UseBasicParsing = $true - Verbose = $true -} -$Latest_Release_Windows_11_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 - -(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 -& "$env:ProgramFiles\WinRAR\RAR.exe" a -sfx -z"Scripts\SFX_config.txt" -ep1 -r "Sophia_Script\Sophia.Script.for.Windows.11.v$($Latest_Release_Windows_11_PowerShell_5_1)_WinGet.exe" "Sophia_Script\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 deleted file mode 100644 index 9cf54a8f..00000000 --- a/Scripts/SFX_config.txt +++ /dev/null @@ -1,8 +0,0 @@ -; Config for creating a WinRAR SFX archive of Sophia Script for Windows 11 for WinGet - -; Expand SFX archive -Path=%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 (Join-Path -Path "$(Get-ItemPropertyValue -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' -Name '{374DE290-123F-4565-9164-39C4925E467B}')" -ChildPath "Sophia_Script_for_Windows_11_vSophiaScriptVersion") -Recurse -Force} -; No GUI while expaning SFX archive -Silent=1 diff --git a/Scripts/WinGet_SFX.ps1 b/Scripts/WinGet_SFX.ps1 new file mode 100644 index 00000000..4b8f8370 --- /dev/null +++ b/Scripts/WinGet_SFX.ps1 @@ -0,0 +1,17 @@ +Write-Verbose -Message SFX -Verbose + +# Install WinRAR +winget install --id RARLab.WinRAR --accept-source-agreements --force + +# Get latest version tag for Windows 11 +$Parameters = @{ + Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/sophia_script_versions.json" + UseBasicParsing = $true + Verbose = $true +} +$Latest_Release_Windows_11_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 + +(Get-Content -Path Scripts\WinGet_SFX_config.txt -Encoding utf8NoBOM -Raw) | Foreach-Object -Process {$_ -replace "SophiaScriptVersion", $Latest_Release_Windows_11_PowerShell_5_1} | Set-Content -Path Scripts\WinGet_SFX_config.txt -Encoding utf8NoBOM -Force + +# Create SFX archive +& "$env:ProgramFiles\WinRAR\RAR.exe" a -sfx -z"Scripts\WinGet_SFX_config.txt" -ep1 -r "Sophia_Script\Sophia.Script.for.Windows.11.v$($Latest_Release_Windows_11_PowerShell_5_1)_WinGet.exe" "Sophia_Script\Sophia_Script_for_Windows_11_v$($Latest_Release_Windows_11_PowerShell_5_1)\*" diff --git a/Scripts/WinGet_SFX_config.txt b/Scripts/WinGet_SFX_config.txt new file mode 100644 index 00000000..aa3f9ea0 --- /dev/null +++ b/Scripts/WinGet_SFX_config.txt @@ -0,0 +1,8 @@ +; Config for creating a WinRAR SFX archive of Sophia Script for Windows 11 for WinGet + +; Expand SFX archive +Path=%TEMP%\Sophia_Script_for_Windows_11_vSophiaScriptVersion +; Copy folder recursively to user's Desktop folder +Setup=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command & {$Downloads = Get-ItemPropertyValue -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' -Name '{374DE290-123F-4565-9164-39C4925E467B}'; Copy-Item -Path "$env:TEMP\Sophia_Script_for_Windows_11_vSophiaScriptVersion" -Destination (Join-Path -Path $Downloads -ChildPath "Sophia_Script_for_Windows_11_vSophiaScriptVersion") -Recurse -Force; Invoke-Item -Path (Join-Path -Path $Downloads -ChildPath "Sophia_Script_for_Windows_11_vSophiaScriptVersion")} +; No GUI while expaning SFX archive +Silent=1