Skip to content

Instantly share code, notes, and snippets.

@CN-CODEGOD
Last active December 14, 2024 06:48
Show Gist options
  • Save CN-CODEGOD/a42458ba755bec66f64a26e5e8e1640a to your computer and use it in GitHub Desktop.
Save CN-CODEGOD/a42458ba755bec66f64a26e5e8e1640a to your computer and use it in GitHub Desktop.
Powershell添加系统环境变量
#获取环境变量
$pspath=[System.Environment]::GetEnvironmentVariable('psModulepath','machine')
#添加环境变量
$pspath+=";$home\modules"
#设置环境变量
[System.Environment]::SetEnvironmentVariable('psmodulepath',$pspath,'machine')
#系统环境变量和用户环境变量的区别
系统环境变量: 'machine'
当前用户环境变量:'User'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment