diff options
author | crupest <crupest@outlook.com> | 2024-03-25 22:31:24 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2024-03-25 22:33:51 +0800 |
commit | 2e1e1936a5e1ddb7a8b62a0c6d8a356867ec6542 (patch) | |
tree | ff2cab342538948d04dbff3ada1c5888829ff137 | |
parent | 23222f895fa615aa9fe43c330b87b7c5779a16ab (diff) | |
download | crupest-2e1e1936a5e1ddb7a8b62a0c6d8a356867ec6542.tar.gz crupest-2e1e1936a5e1ddb7a8b62a0c6d8a356867ec6542.tar.bz2 crupest-2e1e1936a5e1ddb7a8b62a0c6d8a356867ec6542.zip |
configs(pwsh): add my powershell profile.
-rw-r--r-- | configs/Microsoft.PowerShell_profile.ps1 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/configs/Microsoft.PowerShell_profile.ps1 b/configs/Microsoft.PowerShell_profile.ps1 new file mode 100644 index 0000000..38dd7cc --- /dev/null +++ b/configs/Microsoft.PowerShell_profile.ps1 @@ -0,0 +1,38 @@ +Import-Module posh-git +Import-Module "$env:VCPKG_INSTALLATION_ROOT\scripts\posh-vcpkg" + +function Use-VC { + param( + [Parameter()] + [ValidateSet('x64', 'x86')] + $Arch = 'x64' + ) + + if ($Arch -eq 'x86') { + $p = 'x86'; + } + else { + $p = 'amd64' + } + + cmd /c "`"$(vswhere.exe -format value -property installationPath)\VC\Auxiliary\Build\vcvars64.bat`" $p & set" | + ForEach-Object { + if ($_ -match '=') { + $v = $_ -split '=' + Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])" + } + } + Pop-Location + Write-Host "Visual Studio Command Prompt variables set." -ForegroundColor Yellow +} + + +function Set-Proxy { + $env:http_proxy = "http://localhost:2080" + $env:https_proxy = "http://localhost:2080" +} + +function Reset-Proxy { + Remove-Item env:http_proxy + Remove-Item env:https_proxy +} |