File tree Expand file tree Collapse file tree 4 files changed +70
-37
lines changed Expand file tree Collapse file tree 4 files changed +70
-37
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ function prompt {
20
20
# Aliases
21
21
22
22
New-Alias ep Edit-PSProfile
23
- New-Alias vs Invoke-VsDevCmd
23
+ New-Alias vs Set-VsDevEnv
24
24
New-Alias push Push-Location
25
25
New-Alias pop Pop-Location
26
26
@@ -78,7 +78,7 @@ New-Alias dow Start-DockerForWindows
78
78
79
79
# run vsdevcmd.bat if $env:vsdev is set; this is done by conemu task definition
80
80
if ($env: vsdev -eq ' 1' ) {
81
- Invoke-VsDevCmd
81
+ Set-VsDevEnv
82
82
}
83
83
84
84
# Chocolatey profile (added by Chocolatey installer)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Invoke the Visual Studio environment batch script. Should alias this with 'vs'
4
+ #>
5
+
6
+ Begin
7
+ {
8
+ }
9
+ Process
10
+ {
11
+ $script :pushed = $false
12
+
13
+ $0 = " ${env: ProgramFiles} \Microsoft Visual Studio\2022\Professional\Common7\Tools"
14
+ if (Test-Path $0 )
15
+ {
16
+ Write-Host ' ... setting environment for Visual Studio 2022 Professional' - fo DarkYellow
17
+ Push-Location $0
18
+ $script :pushed = $true
19
+ }
20
+ else
21
+ {
22
+ $0 = " ${env: ProgramFiles} \Microsoft Visual Studio\2022\Enterprise\Common7\Tools"
23
+ if (Test-Path $0 )
24
+ {
25
+ Write-Host ' ... setting environment for Visual Studio 2022 Enterprise' - fo DarkYellow
26
+ Push-Location $0
27
+ $script :pushed = $true
28
+ }
29
+ else
30
+ {
31
+ Write-Host ' ... cannot find Visual Studio 2022' - fo Red
32
+ return
33
+ }
34
+ }
35
+
36
+ # run the VsDevCmd script and then call SET to dump the env...
37
+ cmd / c " VsDevCmd.bat & SET" | foreach `
38
+ {
39
+ $line = $_
40
+
41
+ # first index only
42
+ $index = $line.IndexOf (' =' )
43
+ if ($index -gt 0 -and $index -lt $line.Length - 1 )
44
+ {
45
+ $name = $line.Substring (0 , $index )
46
+ $value = $line.Substring ($index + 1 )
47
+
48
+ $def = (Get-Item env:$name - ea:SilentlyContinue).Value
49
+ if ($def -eq $null -or $def -ne $value )
50
+ {
51
+ Write-Host (' {0,-25}' -f $name ) - NoNewline
52
+ Write-Host " $value " - fo DarkGray
53
+
54
+ Set-Item - Force - Path env:$name - Value " $value "
55
+ }
56
+ }
57
+ }
58
+ }
59
+ End
60
+ {
61
+ if ($pushed )
62
+ {
63
+ Pop-Location
64
+ }
65
+ }
Original file line number Diff line number Diff line change @@ -199,9 +199,6 @@ Convenient when you need to run as a normal user from an elevated prompt.
199
199
#### [ ` Invoke-SuperUser ` ] ( Modules/Scripts/Invoke-SuperUser.ps1 )
200
200
Open a new command prompt in elevated mode. Aliased to ` su ` . Special command for ConEmu emulator.
201
201
202
- #### [ ` Invoke-VsDevCmd ` ] ( Modules/Scripts/Invoke-VsDevCmd.ps1 )
203
- Invoke the Visual Studio environment batch script. Aliased to ` vs `
204
-
205
202
#### [ ` New-Administrator ` ] ( Modules/Scripts/New-Administrator.ps1 ) -Username -Password
206
203
Create a new local admin user.
207
204
@@ -264,6 +261,9 @@ Set full-access ownership of a specified Registry key.
264
261
#### [ ` Set-SleepSchedule ` ] ( Modules/Scripts/Set-SleepSchedule.ps1 ) (-SleepTime -WakeTime) | (-Clear [ -ClearTimers] )
265
262
Creates scheduled tasks to sleep and wake the computer at specified times.
266
263
264
+ #### [ ` Set-VsDevEnv ` ] ( Modules/Scripts/Set-VsDevEnv.ps1 )
265
+ Invoke the Visual Studio environment batch script. Aliased to ` vs `
266
+
267
267
#### [ ` Show-ColorizedContent ` ] ( Modules/Scripts/Show-ColorizedContent.ps1 ) -Filename f [ -ExcludeLineNumbers]
268
268
Type the contents of a PowerShell script with syntax highlighting.
269
269
You can’t perform that action at this time.
0 commit comments