I am trying to print path using echo on PowerShell, but the output is %Path%
.
PS C:\> echo %Path%
%Path%
Could you tell me how to go about this?
I am trying to print path using echo on PowerShell, but the output is %Path%
.
PS C:\> echo %Path%
%Path%
Could you tell me how to go about this?
In PowerShell environment variables are expanded via the env
scope:
PS C:\> $env:Path
%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\Windows\system32;C:\Windows;...
%xxx%
variables are a CMD thing.
%Path% is a commandline variable, which is not supported in PowerShell. You'd need to use the appropriate environment variable:
echo $env:Path