Manami’s Translation Blog

2人の男児を育てながら在宅でIT翻訳をしています。育児ブログは別に開設しているので、主に翻訳や仕事に関することをつづっています。

PowerTip: Windows PowerShell を使用して全ての環境変数を一覧表示する

PowerTip: Windows PowerShell を使用して全ての環境変数を一覧表示する

Doctor Scripto

Dr Scripto

 

概要: [System.Environment] を使用して、現在設定されている全ての環境変数を一覧表示する方法を説明します。

A picture containing scissors  Description automatically generated

DOS では SET コマンドを使用すれば、TEMP といった環境変数の値を表示することができました。これと同じことを Windows PowerShell でやる方法を教えてください。

次のように [System.Environment] を使用すれば、現在設定されている環境変数の全ての値を 1 行のコードで一覧表示できます。

[System.Environment]::GetEnvironmentVariables()

PowerShell, Doctor Scripto, PowerTip, Sean Kearney

 

devblogs.microsoft.com