mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 02:22:34 -05:00
Compare commits
2 Commits
18a7f17a0b
...
52de4690ab
Author | SHA1 | Date | |
---|---|---|---|
52de4690ab | |||
ef97a8da24 |
@ -56,7 +56,7 @@ function Test-WinUtilPackageManager {
|
||||
# Check if Winget's Version is too old.
|
||||
$wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v'))
|
||||
# Grabs the latest release of Winget from the Github API for version check process.
|
||||
$response = winget search -e Microsoft.AppInstaller
|
||||
$response = winget search -e Microsoft.AppInstaller --accept-source-agreements
|
||||
$wingetLatestVersion = ($response | Select-String -Pattern '\d+\.\d+\.\d+\.\d+').Matches.Value
|
||||
Write-Host "Latest Search Version: $wingetLatestVersion" -ForegroundColor White
|
||||
Write-Host "Current Installed Version: $wingetCurrentVersion" -ForegroundColor White
|
||||
|
@ -54,21 +54,27 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
|
||||
$PSBoundParameters.GetEnumerator() | ForEach-Object {
|
||||
$argList += if ($_.Value -is [switch] -and $_.Value) {
|
||||
"-$($_.Key)"
|
||||
} elseif ($_.Value -is [array]) {
|
||||
"-$($_.Key) $($_.Value -join ',')"
|
||||
} elseif ($_.Value) {
|
||||
"-$($_.Key) `"$($_.Value)`""
|
||||
"-$($_.Key) '$($_.Value)'"
|
||||
}
|
||||
}
|
||||
|
||||
$script = if ($MyInvocation.MyCommand.Path) {
|
||||
"& { & '$($MyInvocation.MyCommand.Path)' $argList }"
|
||||
$script = if ($PSCommandPath) {
|
||||
"& { & `'$($PSCommandPath)`' $($argList -join ' ') }"
|
||||
} else {
|
||||
"iex '& { $(irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1) } $argList'"
|
||||
"&([ScriptBlock]::Create((irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1))) $($argList -join ' ')"
|
||||
}
|
||||
|
||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
||||
$powershellCmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { "$powershellCmd" }
|
||||
|
||||
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
|
||||
if ($processCmd -eq "wt.exe") {
|
||||
Start-Process $processCmd -ArgumentList "$powershellCmd -ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs
|
||||
} else {
|
||||
Start-Process $processCmd -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user