| |

VerySource

 Forgot password?
 Register
Search
View: 918|Reply: 1

How to determine if a file contains a certain string in batch processing?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-24 14:00:02
| Show all posts |Read mode
To write a batch, execute the following functions: a file file test.txt, if there is a string "abc" in test.txt, execute a batch command a.bat, otherwise execute another processing command b.bat. How to write this batch file?
Thank you!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-12 20:00:02
| Show all posts
@echo off
find "abc" test.txt
if% errorlevel% equ 0 (
a.bat
) else (
 b.bat
)
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list