PowerShell
配置代理
$env:HTTP_PROXY="http://127.0.0.1:10800"
$env:HTTPS_PROXY="https://127.0.0.1:10800"
$env:ALL_PROXY="https://127.0.0.1:10800"
配置文件基础知识
- 查看配置文件路径
echo $profile
提示
- 配置文件一般为
C:\Users\$username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 - 如果该文件不存在,手动创建即可。
命令别名
function mvndr { mvn '-Dmaven.test.skip=true' dependency:resolve dependency:sources }
function mvni { mvn '-Dmaven.test.skip=true' install }
function mvnp { mvn '-Dmaven.test.skip=true' package }
function mvnd { mvn '-Dmaven.test.skip=true' deploy }
提示
PowerShell命令中如果参数带有.,将不会被正常解析,需用单引号括起来。
相关配置
- https://learn.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4
- https://learn.microsoft.com/zh-cn/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.4
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine