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
Post a Comment