查找和使用批处理脚本替换多个文件中的字符串 [英] Find and replace a string in multiple files using Batch script

查看:1130
本文介绍了查找和使用批处理脚本替换多个文件中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件夹中的3000多文件。我希望找到并用另一个替换文本。我该怎么办呢?
我在批处理脚本一个新手。我可以取代它在一个文件中,但我不知道如何在多个文件中替换。

I have more 3000 files in a folder. I want to find and replace text with another one. How can I do that? I'm a newbie in batch script. I can replace it in 1 file but I don't know how to replace in multiple files.

FOR /F %%L IN (lala.txt) DO (
    SET "line=%%L"
    SETLOCAL ENABLEDELAYEDEXPANSION
    set "x=!line:E:\Test=E:\Test\Temp!"
    echo f | xcopy /E !line! !x! 
    ENDLOCAL
)

我如何修改我的code,以取代所有文件的字符串?
等待您的帮助。谢谢

How can I edit my code to replace the string in all files? Waiting for your help. Thanks

推荐答案

安装查找和替换文本命令行实用程序和那么你可以简单地输入

Install the Find And Replace Text command line utility and then you can simply enter

fart *.txt E:\Test E:\Test\Temp

这篇关于查找和使用批处理脚本替换多个文件中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆