Extract number from string in batch file

后端 未结 4 648
余生分开走
余生分开走 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:21

    This uses a helper batch file called repl.bat from - https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat

    @echo off 
    set "string=C:\Users\testing\AppData\Local\Test\abc123\643456\VSALBT81_COM"
    echo "%string%"|repl ".*\\([0-9]*)\\.*" "$1"
    

提交回复
热议问题