https://stackoverflow.com/a/19648045/5079799
@ECHO OFF ::set mystring=Microsoft Office 64-bit Components 2013 set mystring=Microsoft 365 Apps for enterprise - en-us echo mystring = %mystring% for /f "tokens=1-20 delims=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$&*()-= " %%a in ("%mystring%") do ( IF %%a == 64 ( set ONum=%%b GoTo varset ) IF %%a == 32 ( set ONum=%%b GoTo varset ) set ONum=%%a ) :varset echo numfromalphanumstr = %numfromalphanumstr% pause ::https://www.dostips.com/forum/viewtopic.php?t=3499 ::https://superuser.com/questions/1065531/filter-only-numbers-0-9-in-output-in-classic-windows-cmd ::https://stackoverflow.com/questions/19646834/extract-number-from-string-in-batch-file#comment122014887_19648045 ::https://stackoverflow.com/questions/6120623/how-to-extract-number-from-string-in-batch