Last active
August 29, 2015 14:00
-
-
Save rsgoheen/11170255 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-location -Path C:\ | |
$Shell = $Host.UI.RawUI | |
$size = $Shell.WindowSize | |
$size.width=150 | |
$size.height=50 | |
$Shell.WindowSize = $size | |
$size.Width=150 | |
$size.Height=3000 | |
$Shell.BufferSize = $size | |
$shell.BackgroundColor = "DarkBlue" | |
$shell.ForegroundColor = "Yellow" | |
Clear-Host | |
function Add-Path { | |
<# | |
.SYNOPSIS | |
Adds a Directory to the Current Path | |
.DESCRIPTION | |
Add a directory to the current path. This is useful for | |
temporary changes to the path or, when run from your | |
profile, for adjusting the path within your powershell | |
prompt. | |
.EXAMPLE | |
Add-Path -Directory "C:\Program Files\Notepad++" | |
.PARAMETER Directory | |
The name of the directory to add to the current path. | |
#> | |
[CmdletBinding()] | |
param ( | |
[Parameter( | |
Mandatory=$True, | |
ValueFromPipeline=$True, | |
ValueFromPipelineByPropertyName=$True, | |
HelpMessage='What directory would you like to add?')] | |
[Alias('dir')] | |
[string[]]$Directory | |
) | |
PROCESS { | |
$Path = $env:PATH.Split(';') | |
foreach ($dir in $Directory) { | |
if ($Path -contains $dir) { | |
Write-Verbose "$dir is already present in PATH" | |
} else { | |
if (-not (Test-Path $dir)) { | |
Write-Verbose "$dir does not exist in the filesystem" | |
} else { | |
$Path += $dir | |
} | |
} | |
} | |
$env:PATH = [String]::Join(';', $Path) | |
} | |
} | |
Add-Path -Directory “C:\Program Files (x86)\git\bin” | |
Set-Alias np c:\windows\notepad.exe | |
Set-Alias octave C:\Software\Octave-3.6.4\bin\octave-3.6.4.exe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment