List All Environment Variables From the Command Line

Indeed, I required to List all environment variables from the command line in Windows 11. Meanwhile, I write this “List all environment variables from the command line in Windows 11” for all the professionals. You can do this easily with simple echo command and you can also save the output using same echo command with output file name.

List all Environment Variables From the Command Line

Firstly, I am using echo command to list environment variables in Windows 11, then saving in output file. In fact, I used echo command to display the content of environment variable from command prompt, here is the command.

echo %PATH%
List all environment variables from the command line, echo command

SET Command to List Environment Variables

Further, we can use SET command to get the complete environment variables including path in the environment variables section. Here, I included SET command screenshot for the reference to create visualization.

SET %PATH%
List all environment variables from the command line, SET Command

Export Environment variables To a Text File

Finally, You can export Environment variables to a text file using the command prompt.

  • Firstly, You can use the same echo command and export environment variables to a text file.
echo %PATH% >"D:\Workspace\ExportEnv.txt"
Export Environment variables To a Text File with Echo Command
  • Secondly, You can use the SET command and export environment variables to a text file but this example didn’t worked with me.
Export Environment variables To a Text File with set Command

Print Environment Variables in PowerShell

Of course, you can view the Environment variables in PowerShell but you cannot use echo %PATH% command in PowerShell. In fact, You can execute the PowerSehll command and then PowerShell let you to show output as required. Further, You can read print environment variables in PowerShell tutorial to do the same task more professionally.

Share

You may also like...