Echo %path% on separate lines?
Using the windows command prompt, can I echo %path% and get the resulting paths on separate rows? Something like this but for windows:
echo $path | tr ':' '\n'
Can I do this with vanilla cmd or do I need powershell or js scripting?
Example echo %path% output:
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;
Desired output:
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;
C:\Program Files\Microsoft SQL Server\90\Tools\binn\;
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;
Solution 1:
Try:
($env:Path).Replace(';',"`n")
or
$env:path.split(";")
Solution 2:
Fewer keystrokes using either the split operator or method
$env:Path -split ';'
$env:Path.split(';')
Solution 3:
this works for me (in a cmd window):
powershell -Command ($env:Path).split(';')