Wednesday, December 13, 2006

Environment variables

To use the standard windows environment variables (temp, computername, windir, etc.) in PowerShell, you can use the following notation:


Or, if the full names (not 8.3 DOS notation) are required:


Note that if $env:path is needed, you have to use the first notation (which in this case returns the full path/file names).


[io.path]::GetFullPath($env:path) ## Won't work, as the returned value is too large.

No comments: