Powershell does not put system variable in path -


putting following in powershell console, outputs variable value:

[environment]::username 

putting this:

ps c:\> test-path c:\users\${[environment]::username}\appdata\local\microsoft\outlook false 

odd, went ahead , outputted console itself:

ps c:\> write-host c:\users\${[environment]::username}\appdata\local\microsoft\outlook c:\users\\appdata\local\microsoft\outlook 

it returns blank. why? putting variable directly console output value while passing doesnt...

you should use $env:localappdata since don't have hard code c:\. should use join-path cmdlet if want join path:

$path = join-path $env:localappdata 'microsoft\outlook' 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -