I am writing an uninstallation script, so I would like to \'undo\' modifications the installation made to the system. In achieving this goal, I would like to parse the
FOR /F "delims=;" %%A IN (%TEMP_PATH%) DO ECHO %%A
How can I loop through an unknown number of tokens and work with each one?
Use the following batch file.
SplitPath.cmd:
@echo off
setlocal
for %%a in ("%path:;=";"%") do (
echo %%~a
)
endlocal
Example Output:
F:\test>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apps\WSCC\Sysinternals Suite;C:\apps\WSCC\NirSoft Utilities
F:\test>splitpath
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\apps\WSCC\Sysinternals Suite
C:\apps\WSCC\NirSoft Utilities
Notes:
for loop as appropriate to implement the rest of your pseudocode.