![Share on Facebook Facebook](https://www.rootlinks.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/48x48/facebook.png)
![Share on Twitter twitter](https://www.rootlinks.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/48x48/twitter.png)
![Share by email mail](https://www.rootlinks.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/48x48/mail.png)
Powershellで環境変数を操作する方法
- すべての環境変数を表示
- 環境変数を指定して表示
- 変数に代入
- 環境変数を設定
1 2 3 4 5 6 7 8 |
; html-script: false ] PS C:\> Get-ChildItem env: Name Value ---- ----- ALLUSERSPROFILE C:\ProgramData APPDATA C:\Users\matsuoka\AppData\Roaming (snip) |
1 2 3 4 5 6 7 8 9 10 11 12 |
; html-script: false ] PS C:\> gci env:username Name Value ---- ----- USERNAME matsuoka PS C:\> gc env:username matsuoka PS C:\> $env:computername pc01 |
1 2 3 4 |
; html-script: false ] PS C:\> $user = $env:username PS C:\> $user matsuoka |
1 2 3 4 |
; html-script: false ] PS C:\> $env:username = "tanaka" PS C:\> gc env:username tanaka |
参考サイト
Environment Variables
http://ss64.com/ps/syntax-env.html