Path Environment Variable Windows 10. Echo %Path% on command prompt shows only %Path%

11

My variable value in path is as follows

C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts;C:\SQLite

When I type echo %Path% on command prompt, I get below output

PS C:\Users\Arun> echo %Path%
%Path%

Why is this?

Arun S

Posted 2017-06-06T21:10:58.813

Reputation: 119

Question was closed 2017-06-06T22:11:52.203

if you see PS at the start of the prompt PS C:\Users\Arun> then it's the default prompt string of powershell, not cmd – phuclv – 2019-11-27T06:09:11.760

Answers

18

PowerShell uses a different syntax than Windows Command Prompt.

Use $Env:Path or Get-ChildItem Env:Path to retrieve the PATH variable.

Source: Creating and Modifying Environment Variables - Microsoft Technet

Steven

Posted 2017-06-06T21:10:58.813

Reputation: 24 804

7

Since Windows 10 Insider Build 14971 Microsoft changed the default command shell to be PowerShell instead of cmd.

PowerShell handles environment variables differently to cmd.

To display their values in PowerShell use the following syntax:

$Env:variablename

Example:

> echo %Path%
%Path%
> $Env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apps\WSCC\Sysinternals Suite;C:\apps\WSCC\NirSoft Utilities
>

Further Reading

DavidPostill

Posted 2017-06-06T21:10:58.813

Reputation: 118 938