Skip to content

Instantly share code, notes, and snippets.

@decriptor
Created November 20, 2018 01:30
Show Gist options
  • Save decriptor/fcda6762dcbeca4e055243814fac01fc to your computer and use it in GitHub Desktop.
Save decriptor/fcda6762dcbeca4e055243814fac01fc to your computer and use it in GitHub Desktop.
### Set environment variables for Visual Studio Command Prompt
Push-Location 'C:\Program Files (x86)\Microsoft Visual Studio\16\Preview\Common7\Tools'
cmd /c "VsDevCmd.bat&set" |
ForEach-Object {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
Pop-Location
Write-Host "`nVisual Studio 2019 Command Prompt variables set." -ForegroundColor Yellow
###
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
# function loader
#
# if you want to add functions you can added scripts to your
# powershell profile functions directory or you can inline them
# in this file. Ignoring the dot source of any tests
Resolve-Path $here\functions\*.ps1 |
Where-Object { -not ($_.ProviderPath.Contains(".Tests.")) } |
ForEach-Object { . $_.ProviderPath }
# inline functions, aliases and variables
function which($name) { Get-Command $name | Select-Object Definition }
function rm-rf($item) { Remove-Item $item -Recurse -Force }
function touch($file) { "" | Out-File $file -Encoding ASCII }
Set-Alias g gvim
$TransientScriptDir = "$here\scripts"
$UserBinDir = "$($env:UserProfile)\bin"
# PATH update
#
# creates paths to every subdirectory of userprofile\bin
# adds a transient script dir that I use for experiments
$paths = @("$($env:Path)", "C:\Program Files\Git\cmd", $TransientScriptDir)
$paths = @("$($env:Path)", "C:\Users\stepsha\AppData\Roaming\Python\Python37\Scripts", $TransientScriptDir)
Get-ChildItem $UserBinDir | ForEach-Object { $paths += $_.FullName }
$env:Path = [String]::Join(";", $paths)
Import-Module Posh-Git
Start-SshAgent
#Add-SshKey (Resolve-Path ~\.ssh\id_rsa)
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment