2012-02-19 29 views
0

我有超過100個文件的文件夾,這些文件中包含的文字。我使用這個.bat代碼將某些文本提取到另一個文本文件中。使用批處理文件來提取一個文件中的文本到一個新的

SETLOCAL 
(FOR /L %%i IN (1,1,3) DO SET /P line=) <math.txt> lines.txt ECHO %line% 
ENDLOCAL 

此腳本僅適用於每次一個.txt文件。它不僅需要從多個文件中提取,而且需要在多個文件中以文件到文件的順序重新寫入。完成此操作後,我想運行另一個腳本將提取的文本輸入到1個文件到1個表格的序列中的程序表單字段中。我發現了一個腳本來操作鼠標點擊,這將運行該程序,但老實說這是我的專業知識。

WshShell.Sendkeys "%f" (simulates clicking "File" on the menu bar) 
WshShell.Sendkeys "n" (simulates clicking the "New" option on the "File" menu) 
WshShell.Sendkeys "{Enter}" (simulates clicking "OK" to finish creating a new document in Word) 

回答

0

好吧,看來你需要知道FOR命令來選擇哪些文件讀取(中的.txt),但只是有

type (insert input dir here) >> (insert ouput dir here) 
相關問題