通过Get-ChildItem列出所有的环境变量
Get-ChildItem env:
Name Value
---- -----
ALLUSERSPROFILE C:ProgramData
ANDROID_HOME C:UserslinxmouseAppDataLocalAndroidSdk
APPDATA C:UserslinxmouseAppDataRoaming
ChocolateyInstall C:ProgramDatachocolatey
ChocolateyLastPathUpdate 132333362211161774
CommonProgramFiles C:Program FilesCommon Files
CommonProgramFiles(x86) C:Program Files (x86)Common Files
CommonProgramW6432 C:Program FilesCommon Files
COMPUTERNAME DESKTOP-1FO62S5
ComSpec C:WINDOWSsystem32cmd.exe
DriverData C:WindowsSystem32DriversDriverData
FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn
HALCONARCH x64-win64
HALCONEXAMPLES C:UsersPublicDocumentsMVTecHALCON-17.12-Progressexamples
HALCONIMAGES C:UsersPublicDocumentsMVTecHALCON-17.12-Progressexamplesimages
HALCONROOT d:Program FilesMVTecHALCON-17.12-Progress
HOME C:Userslinxmouse
HOMEDRIVE C:
HOMEPATH Userslinxmouse
JAVA_HOME D:Program FilesJavajre1.8.0_251
LESSCHARSET utf-8
LOCALAPPDATA C:UserslinxmouseAppDataLocal
LOGONSERVER \DESKTOP-1FO62S5
NUMBER_OF_PROCESSORS 12
OneDrive C:UserslinxmouseOneDrive
OS Windows_NT
Path C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPo...
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
PROCESSOR_ARCHITECTURE AMD64
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
PROCESSOR_LEVEL 6
PROCESSOR_REVISION 9e0a
ProgramData C:ProgramData
ProgramFiles C:Program Files
ProgramFiles(x86) C:Program Files (x86)
ProgramW6432 C:Program Files
PSModulePath C:UserslinxmouseDocumentsWindowsPowerShellModules;C:Program FilesWindowsPowerS...
PUB_HOSTED_URL https://pub.flutter-io.cn
PUBLIC C:UsersPublic
SystemDrive C:
SystemRoot C:WINDOWS
TEMP C:UsersLINXMO~1AppDataLocalTemp
TMP C:UsersLINXMO~1AppDataLocalTemp
USERDOMAIN DESKTOP-1FO62S5
USERDOMAIN_ROAMINGPROFILE DESKTOP-1FO62S5
USERNAME linxmouse
USERPROFILE C:Userslinxmouse
VBOX_MSI_INSTALL_PATH D:Program FilesOracleVirtualBox
windir C:WINDOWS
WSLENV WT_SESSION::WT_PROFILE_ID
WT_PROFILE_ID {61c54bbd-c2c6-5271-96e7-009a87ff44bf}
WT_SESSION 4dc413e1-5ed9-46d4-b4f0-5a2fec7aeb44
WXDRIVE_START_ARGS --wxdrive-setting=0 --disable-gpu --disable-software-rasterizer --enable-features=Net...
通过ls列出所有的环境变量
ls env:
Name Value
---- -----
ALLUSERSPROFILE C:ProgramData
ANDROID_HOME C:UserslinxmouseAppDataLocalAndroidSdk
APPDATA C:UserslinxmouseAppDataRoaming
ChocolateyInstall C:ProgramDatachocolatey
ChocolateyLastPathUpdate 132333362211161774
CommonProgramFiles C:Program FilesCommon Files
CommonProgramFiles(x86) C:Program Files (x86)Common Files
CommonProgramW6432 C:Program FilesCommon Files
COMPUTERNAME DESKTOP-1FO62S5
ComSpec C:WINDOWSsystem32cmd.exe
DriverData C:WindowsSystem32DriversDriverData
FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn
HALCONARCH x64-win64
HALCONEXAMPLES C:UsersPublicDocumentsMVTecHALCON-17.12-Progressexamples
HALCONIMAGES C:UsersPublicDocumentsMVTecHALCON-17.12-Progressexamplesimages
HALCONROOT d:Program FilesMVTecHALCON-17.12-Progress
HOME C:Userslinxmouse
HOMEDRIVE C:
HOMEPATH Userslinxmouse
JAVA_HOME D:Program FilesJavajre1.8.0_251
LESSCHARSET utf-8
LOCALAPPDATA C:UserslinxmouseAppDataLocal
LOGONSERVER \DESKTOP-1FO62S5
NUMBER_OF_PROCESSORS 12
OneDrive C:UserslinxmouseOneDrive
OS Windows_NT
Path C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPo...
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
PROCESSOR_ARCHITECTURE AMD64
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
PROCESSOR_LEVEL 6
PROCESSOR_REVISION 9e0a
ProgramData C:ProgramData
ProgramFiles C:Program Files
ProgramFiles(x86) C:Program Files (x86)
ProgramW6432 C:Program Files
PSModulePath C:UserslinxmouseDocumentsWindowsPowerShellModules;C:Program FilesWindowsPowerS...
PUB_HOSTED_URL https://pub.flutter-io.cn
PUBLIC C:UsersPublic
SystemDrive C:
SystemRoot C:WINDOWS
TEMP C:UsersLINXMO~1AppDataLocalTemp
TMP C:UsersLINXMO~1AppDataLocalTemp
USERDOMAIN DESKTOP-1FO62S5
USERDOMAIN_ROAMINGPROFILE DESKTOP-1FO62S5
USERNAME linxmouse
USERPROFILE C:Userslinxmouse
VBOX_MSI_INSTALL_PATH D:Program FilesOracleVirtualBox
windir C:WINDOWS
WSLENV WT_SESSION::WT_PROFILE_ID
WT_PROFILE_ID {61c54bbd-c2c6-5271-96e7-009a87ff44bf}
WT_SESSION 4dc413e1-5ed9-46d4-b4f0-5a2fec7aeb44
WXDRIVE_START_ARGS --wxdrive-setting=0 --disable-gpu --disable-software-rasterizer --enable-features=Net...
获取环境变量的值
$env:path
C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:WINDOWSSystem32OpenSSH;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program FilesMicrosoft SQL ServerClient SDKODBC170ToolsBinn;d:Program FilesMVTecHALCON-17.12-Progressinx64-win64;d:Program FilesGitcmd;C:Program Filesdotnet;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:UserslinxmouseAppDataLocalProgramsPythonPython37Scripts;C:UserslinxmouseAppDataLocalProgramsPythonPython37;C:UserslinxmouseAppDataLocalMicrosoftWindowsApps;D:Program FilesJavajre1.8.0_251in;d:Program FilesLLVMin;d:ProgramsMicrosoft VS Codein;D:flutterin;D:flutter.pub-cachein;D:flutterincachedart-sdkin;C:UserslinxmouseAppDataLocalAndroidSdk ools;C:UserslinxmouseAppDataLocalAndroidSdkplatform-tools;D:Program Filesprotoc-3.11.4-win64in;C:Userslinxmouse.dotnet ools;C:UserslinxmouseAppDataLocalMicrosoftWindowsApps;C:Userslinxmouse.dotnet ools