Skip to content

Commit

Permalink
win.ps1 replace args[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlivio committed Nov 17, 2024
1 parent 9ed16a5 commit 86641e3
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions os_win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,31 +194,36 @@ function win_install_nodejs_noadmin() {
}

function _winget_install() {
winget install --accept-package-agreements --accept-source-agreements --scope user -e --id $Args
winget install --accept-package-agreements --accept-source-agreements --scope user -e --id $args
}

function winget_install() {
winget list --accept-source-agreements -q $Args[0] | Out-Null
param ([Parameter(Mandatory = $true)][string] $pkg)
winget list --accept-source-agreements -q $pkg | Out-Null
if (-not $?) {
_winget_install $Args[0]
_winget_install $pkg
}
}

function winget_install_at_location() {
winget list --accept-source-agreements -q $Args[0] | Out-Null
param (
[Parameter(Mandatory = $true)][string] $pkg,
[Parameter(Mandatory = $true)][string] $location
)
winget list --accept-source-agreements -q $pkg | Out-Null
if (-not $?) {
_winget_install --location="$Args[1]" $Args[0]
_winget_install --location="$location" $pkg
}
}

function winget_uninstall() {
winget list --accept-source-agreements -q $Args | Out-Null
param ([Parameter(Mandatory = $true)][string] $pkg)
winget list --accept-source-agreements -q $pkg | Out-Null
if ($?) {
winget uninstall --silent "$Args"
winget uninstall --silent "$pkg"
}
}


function win_check_winget() {
if (-Not(Get-Command winget -errorAction SilentlyContinue)) {
Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
Expand Down Expand Up @@ -453,7 +458,7 @@ function win_onedrive_reset() {
}

function win_desktop_wallpaper_folder() {
$dir = $args[0]
param ([Parameter(Mandatory = $true)][string] $dir)
if (Test-Path $dir) {
$dir = (Resolve-Path $dir).Path
$reg = "HKCU:\Control Panel\Desktop"
Expand Down

0 comments on commit 86641e3

Please sign in to comment.