I have a task: print all entries of %PATH% variable on new line. For example:
C:\Program Files\
C:\Windows
C:\Windows\System32
and so on...
I have a task: print all entries of %PATH% variable on new line. For example:
C:\Program Files\
C:\Windows
C:\Windows\System32
and so on...
Solved: I used echo %path:;=&echo(%
Source: How do I view/see the PATH in a windows environment? (the original link is dead, now linking to WebArchive)
@ECHO OFF
SETLOCAL
SET count=1
:loop
FOR /f "tokens=%count%delims=;" %%i IN ("%path%") DO ECHO %%i&SET /a count+=1&GOTO loop
ECHO %count% entries found
Not hard - simply use TOKENS to select the token number until they run out. May want to echo %%~i
to strip quoted paths if you want. count displayed because it's there.