2014-10-10 214 views

回答

1
@echo off 

set INPUT=a.txt 

for /f delims^=^"^ tokens^=2 %%a in ('findstr /i "Name" "%INPUT%"') do set NAME=%%a 
for /f "tokens=2 delims=; " %%b in ('findstr /i "ID" "%INPUT%"') do set ID=%%b 

set FNAME=%NAME%_%ID%.kla 
echo %FNAME% 

a.txt中包含2行:

Name "Jon"; 
ID 1234; 

輸出:

Jon_1234.kla 

信用:rkagerer在Escaping double-quote in delims

+0

非常感謝親愛的答案。所有最好:) – 2014-10-10 10:28:13

+0

我親愛的可以幫我關於這篇文章的plz?非常感謝https://stackoverflow.com/questions/26315853/read-the-file-names-of-all-kla-files-in-a-directory-rename-them-and-move-them – 2014-10-11 17:42:43

+0

親愛的,那裏是錯誤:FINDSTR:無法打開C:\ TSData \ Klarf \ NAC_01112_3.kla。你能告訴爲什麼PLZ? – 2014-10-11 23:32:03

相關問題