简体   繁体   中英

Batch file to find string “-date=8/27/2015” in a line of a text file and write the line out to another file

I have a text file and would like to write a batch script that searches for the string "-date=8/27/2015" and write that line out to a new text file. Here is what I have tried:

for /F "tokens=*" %%A in (report4.bat) do findstr.exe /m "-date=8/27/2015" "%%A" >>%userprofile%\Desktop\report6.bat

for /F "tokens=*" %%A in (report4.bat) do findstr.exe /m "-date=8/27/2015" "%%A" && echo %%A >>%userprofile%\Desktop\report6.bat

findstr.exe /x /c "-date=8/27/2015" /f report4.bat >>%userprofile%\Desktop\report6.bat

Does anyone have any ideas?

Any help would greatly be appreciated. Thanks,

快完成了

findstr.exe /l /c:"-date=8/27/2015" report4.bat >>"%userprofile%\Desktop\report6.bat"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM