In CMD, when i type PATH
, the output:
Path=C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;
I need to split each path with new line, then the output to become:
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\
C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\
C:\Windows\system32
C:\Windows
I can do this in PowerShell with $Env:Path.Split(';')
, or calling it from CMD powershell -c "$Env:Path.Split(';')"
.
How I do this in CMD it self?
I Tried:
For /F "Tokens=1* Delims=;" %A in ('%PATH%') do @Echo %A %B
For /F "Tokens=1* Delims=;" %A in (%PATH%) do @Echo %A %B
giving error: \Intel\Intel(R) was unexpected at this time.
Thanks to T3RR0R.
@For %G in ("%PATH:;=" "%")Do @Echo(%~G
Best Answer
You can use a FOR loop. Save this into BATCH-file (eg. split_path.bat)
It should split the PATH variable based on the semicolon delimiter and print each path on a new line.