Extract number from string in batch file

后端 未结 4 647
余生分开走
余生分开走 2021-01-07 06:54

From a batch file I want to extract the number 653456 from the following string:

C:\\Users\\testing\\AppData\\Local\\Test\\abc123\\643456\\VSALB         


        
4条回答
  •  一生所求
    2021-01-07 07:12

    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"
    

提交回复
热议问题