Browse Source

Update SFX.ps1

pull/679/head
Dmitry Nefedov 4 months ago
parent
commit
904c499df7
  1. 16
      Scripts/SFX.ps1
  2. 8
      Scripts/SFX_config.txt

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

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