Skip to content

Instantly share code, notes, and snippets.

@yattom
Created March 9, 2017 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yattom/8bccc41b5fbd0e43f3ef6f7473f746d7 to your computer and use it in GitHub Desktop.
Save yattom/8bccc41b5fbd0e43f3ef6f7473f746d7 to your computer and use it in GitHub Desktop.
function prompt() {
Write-Host "[" -nonewline
Write-Host "$(Get-Location)" -foregroundcolor Cyan -nonewline
Write-Host "]" -nonewline
Write-Host " ${env:USERNAME}@${env:COMPUTERNAME}" -foregroundcolor Magenta
"> "
}
function Add-Path($path) {
if("" -eq $path) {
return
}
if($env:Path.Contains($path + ";")) {
return
}
Set-Item env:Path "${path};${env:Path}"
}
# utility
Add-Path $home\tools
# python
Add-Path $home\tools\python3
Add-Path $home\tools\python3\Scripts
Set-Alias which Which-Command
function Which-Command($cmd) {
$obj = Get-Command $cmd
switch($obj.CommandType) {
"Alias" { "Alias -> " + $obj.ResolvedCommand.Name}
"Cmdlet" { "Cmdlet (" + $obj.Source + ")" }
"Function" { $obj.Definition }
default { ($obj.Source) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment