minor path changes

This commit is contained in:
Jeremy Wall 2020-02-09 07:44:46 -06:00
parent e3360fed8f
commit 760c09841e
2 changed files with 22 additions and 7 deletions

View File

@ -17,9 +17,19 @@ function Invoke-Elevated {
param (
[ScriptBlock]
$code
)
# Elevate our permissions for this first.
Start-Process powershell.exe -ArgumentList $code -WindowStyle hidden -Verb RunAs
)
$outTmpFile = [System.IO.Path]::GetTempFileName()
$errTmpFile = [System.IO.Path]::GetTempFileName()
$code | Write-Output
$outTmpFile | Write-Output
$errTmpFile | Write-Output
# TODO(jwall): Work on figuring out how to properly redirect output here
Start-Process powershell.exe -ArgumentList { &$code 1>$outTmpFile 2>$errTmpFile } -WindowStyle hidden -Verb RunAs
Get-Content $outTmpFile | Write-Output
Get-Content $errTmpFile | Write-Output
Remove-Item $outTmpFile
Remove-Item $errTmpFile
}
<#
@ -50,11 +60,11 @@ function Get-Elevated {
function New-Link {
param (
[Parameter(Position=0, Mandatory=$true)]
[String[]]
[string[]]
$Source,
[Parameter(Position=1, Mandatory=$true)]
[String[]]
[string[]]
$Destination
)
@ -70,7 +80,12 @@ function New-Link {
}
}
function grep {
$input | out-string -stream | select-string $args
}
# It's way more useful to call this open than ii
Set-Alias -Name open -Value Invoke-Item
Set-Alias -Name ln -Value New-Link
# Add make to our powershell path
$env:PATH="$env:PATH;C:\Program Files (x86)\GnuWin32\bin"
$env:PATH="$env:PATH;C:\Program Files (x86)\GnuWin32\bin;C:\Users\jerem\AppData\Local\Julia-1.3.0\bin"

View File

@ -11,5 +11,5 @@ Make-Link -Source "./PowerShellProfile.ps1" -Destination $profile
Invoke-Elevated {
Get-NetAdapter | ForEach-Object {
Set-DnsClientServerAddress -InterfaceIndex $_.ifIndex -ServerAddresses 1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001
}
}
}