Browse Source

Updated WinGet SFX config

pull/712/head
Dmitry Nefedov 2 months ago
parent
commit
59cf2de3ac
  1. 17
      Scripts/SFX.ps1
  2. 8
      Scripts/SFX_config.txt
  3. 17
      Scripts/WinGet_SFX.ps1
  4. 8
      Scripts/WinGet_SFX_config.txt

17
Scripts/SFX.ps1

@ -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)\*"

8
Scripts/SFX_config.txt

@ -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

17
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)\*"

8
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
Loading…
Cancel
Save