0

I need to make a FOR loop to do some operations with each path in %PATH% variable. But FOR sees %PATH% as one line and makes only one iteration for the whole variable. How can I parse every directory's path in %PATH%?

michaeluskov
  • 1,729
  • 7
  • 27
  • 53

1 Answers1

1
for %G in ("%path:;=" "%") do @echo %G

From:

http://ss64.com/nt/path.html

kichik
  • 33,220
  • 7
  • 94
  • 114
  • 1
    This will not work if PATH contains some paths that are already quoted. http://stackoverflow.com/q/5471556/1012053 has an answer that will always work. – dbenham Nov 02 '12 at 18:45