From 760c09841e8baf109c333363972dd266165a52da Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Sun, 9 Feb 2020 07:44:46 -0600 Subject: [PATCH] minor path changes --- PS/PowerShellProfile.ps1 | 27 +++++++++++++++++++++------ PS/bootstrap.ps1 | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/PS/PowerShellProfile.ps1 b/PS/PowerShellProfile.ps1 index fd062b2..ea84338 100644 --- a/PS/PowerShellProfile.ps1 +++ b/PS/PowerShellProfile.ps1 @@ -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" \ No newline at end of file +$env:PATH="$env:PATH;C:\Program Files (x86)\GnuWin32\bin;C:\Users\jerem\AppData\Local\Julia-1.3.0\bin" \ No newline at end of file diff --git a/PS/bootstrap.ps1 b/PS/bootstrap.ps1 index f65f98e..79e4a7e 100644 --- a/PS/bootstrap.ps1 +++ b/PS/bootstrap.ps1 @@ -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 - } + } } \ No newline at end of file