0

Can any share a batch script that prints each batch entry in a new row?

eg - if Path = C:\Python27;C:\Python27\Scripts

Then it shall get printed as

C:\Python27
C:\Python27\Scripts
bee2
  • 25
  • 4

1 Answers1

1

I have a VBscript that does this:

Set oShell = CreateObject( "WScript.Shell" )
pathList = oShell.ExpandEnvironmentStrings("%PATH%")

dirs = Split(pathList, ";", -1, 1)

For i = 0 to UBound(dirs)
   WScript.Echo dirs(i)
Next

Save it as e.g. list_path.vbs and you can use it just like any other batch file.

If you can't run it by entering list_path you need to adjust the value of PATH_EXT in order to include .vbs (but I think that is the default in modern Windows versions - I can't remember having to adjust that)