I just checked stackoverflow that seemed to be very helpful and worked fine on Windows XP. But using Windows 7 it does not work for some obscure reason.
The PATH
variable looks like this
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\
It obviously contains \ as well as semicolons I use to split in a batch that contains this FOR-loop:
FOR /F "delims=;" %%A IN ("%PATH%") DO (
echo %%A
)
Executing does not cause any error but it provides just one (the first) token
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
I had no idea why FOR terminates and played around with several variations that have been suggested on the net but none did the job.
Any help will be highly appreciated.
Christian
You could do it this way.
for %%A in ("%path:;=";"%") do (
echo %%~A
)
(Source)
The problem with the way you have it is that, using the for /F
switch, %%A
only specifies the first token. You would have to do for /f "tokens=1-9 delims=;" %%A in ("%PATH%")
and read in %%A
through %%I
that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With