examinedliving
8/16/2013 - 4:16 PM

Split Windows Path variable (or anything else) into seperate lines to view easily from command line.

Split Windows Path variable (or anything else) into seperate lines to view easily from command line.

:: This assumes you are running from command line.  To run from batch script, add the next commented out line to the top of
:: your batch file.  Also, in a batch file the % sign before the i should be doubled, .e.g. %%i.

:: batch file only - remove preceeding semicolons from the next line and insert in batch file.
:: SETLOCAL ENABLEDELAYEDEXPANSION

:: from command prompt only - add the next line

cmd /v:on

for /f "tokens=*" %i in ("%path%") do set a=%i && set b=!a:;=^&echo.!

echo %b%


:: output displays a single column of (in this case) path names.  
:: Can be used to split other items into a column from the command line.  Just put whatever
:: delimiter you want to split by after the `a:` where the semicolon is now in the code above.