List all environment variables from command line?

2019-01-09 21:05发布

I'd like to know if it's possible to list ALL environment variables from Windows' Command Prompt.

Something equivalent to PowerShell's gci env: (or ls env: or dir env:).

9条回答
Fickle 薄情
2楼-- · 2019-01-09 21:37

Jon has the right answer, but to elaborate a little more with some syntactic sugar..

SET | more

enables you to see the variables one page at a time, rather than the whole lot, or

SET > output.txt

sends the output to a file output.txt which you can open in notepad or whatever...

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-09 21:38

don't lose time to search it in registry

reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"

returns less then set command

查看更多
Rolldiameter
4楼-- · 2019-01-09 21:40

You can use SET in cmd

To show the current variable, just SET is enough

To show certain variable such as 'PATH', use SET PATH.

For help, type set /?.

查看更多
登录 后发表回答