From a batch file I want to extract the number 653456 from the following string:
653456
C:\\Users\\testing\\AppData\\Local\\Test\\abc123\\643456\\VSALB
Assuming the number is always the parent folder (the folder before the end):
@echo off set "str=C:\Users\testing\AppData\Local\Test\abc123\643456\VSALBT81_COM" for %%F in ("%str%\..") do set "number=%%~nxF"