-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMicrosoft.PowerShell_profile.ps1
67 lines (52 loc) · 1.39 KB
/
Microsoft.PowerShell_profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Add-PSSnapin AzureManagementCmdletsSnapIn
Add-PSSnapin CloudServicesCmdlets
. 'C:\projectsgit\posh-git\profile.example.ps1'
. 'C:\DevKit\devkitvars.ps1'
function Start-Explorer{
if(!$args) { explorer . }
else { explorer $args }
}
Set-Alias e Start-Explorer
function Start-Vim
{
& "C:\Program Files (x86)\Vim\vim73\vim.exe" $args
}
Set-Alias vim Start-Vim
function Start-Notepad{
& "C:\Program Files (x86)\Notepad++\notepad++.exe" $args
}
set-alias n Start-Notepad
function Start-VisualStudio{
param([string]$projFile = "")
if($projFile -eq ""){
ls *.sln | select -first 1 | %{
$projFile = $_
}
}
if(($projFile -eq "") -and (Test-Path src)){
ls src\*.sln | select -first 1 | %{
$projFile = $_
}
}
if($projFile -eq ""){
echo "No project file found"
return
}
echo "Starting visual studio with $projFile"
. $projFile
}
set-alias vs Start-VisualStudio
# Preserve history across sessions
Register-EngineEvent PowerShell.Exiting {
Get-History -Count 32767 | Group CommandLine | Foreach {$_.Group[0]} | Export-CliXml "$home\pshist.xml"
} -SupportEvent
Import-CliXml "$home\pshist.xml" | Add-History
#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd