In a batch file, how can I get the last token in a variable regardless of whether it is a number or a word and regardless of how many tokens/words there are in the variable.
Why so complicated?
set var1=This is a String
for %%A in (%var1%) do set last=%%A
set xcmd=c:\monitor.exe -C custom_performance_counter -t %1 -w 80 -c 90
for /f "tokens=*" %%I in ('%xcmd%') do for %%A in (%%~I) do set last=%%A
echo last=%last%