Skip to content

Instantly share code, notes, and snippets.

@josephspurrier
Last active April 26, 2019 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephspurrier/636c4226af85970c6f647d35ea1b1be5 to your computer and use it in GitHub Desktop.
Save josephspurrier/636c4226af85970c6f647d35ea1b1be5 to your computer and use it in GitHub Desktop.
Windows PowerShell Profile
# Store this document in the following location:
# C:\Users\username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# You'll have to enabled remote execution first (run as admin): Set-ExecutionPolicy RemoteSigned
# Gist: https://gist.github.com/josephspurrier/636c4226af85970c6f647d35ea1b1be5
# This profile makes it easy to set your GOPATH and modify your PATH environment
# variables easily when switching between Visual Studio workspaces.
# Add the gotools to the path.
$env:Path += "C:\Users\"+$env:username+"\Documents\gotools\bin;"
# Add the current directory to the PATH environment variable.
function f_pathx() {
$env:Path += (Get-Item -Path ".\" -Verbose).FullName + ";"
}
New-Alias pathx f_pathx
# Output the PATH environment variable.
function f_path() {
echo $env:Path
}
New-Alias path f_path
# Set GOPATH environment variable to the current directory.
function f_gop() {
$env:GOPATH = (Get-Item -Path ".\" -Verbose).FullName
}
New-Alias gop f_gop
# Output the GOPATH environment variable.
function f_gopath() {
echo $env:GOPATH
}
New-Alias gopath f_gopath
# Add Go 1.7 to the PATH environment variable.
function f_go17() {
$env:Path += "C:\Users\"+$env:username+"\go1.7.6\bin;"
}
New-Alias go17 f_go17
# Add Go 1.8 to the PATH environment variable.
function f_go18() {
$env:Path += "C:\Users\"+$env:username+"\go1.8.3\bin;"
}
New-Alias go18 f_go18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment