如何使用批处理搜索和替换区分大小写的字符串

2023-12-01

我想搜索并替换区分大小写的字符串

就像如果我在文本文件中有rise Rise RISE,我只想替换字符串“rise” 下面的代码是替换所有三个字符串。

请帮助我!

@Echo on
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION

set file="c:\Users\rawal\Desktop\a\file.txt"
set /p Input=Enter some text:
set OldStr="rise"
set NewStr=%Input% 

for /f "tokens=1,* delims=]" %%A in ('"type %file% |find /n /v """') do (
set "line=%%B"
if defined line (
call echo %%line:%OldStr%=%NewStr%%%>> %file%_new
) ELSE echo.
)

move /Y %file%_new %file% > nul

这是我长期以来感兴趣的一个话题。我个人的标准是,该解决方案是一个仅使用本机 Windows 命令的脚本,并且它与 XP 以后的所有 Windows 版本兼容。

我开发了两种解决方案:1) 纯批处理解决方案,我认为它对于批处理来说是尽可能高效的;2) 混合 JScript/批处理解决方案,功能极其强大且速度非常快。

我几乎放弃了纯批处理解决方案,转而使用 JScript/批处理混合解决方案,因为混合解决方案具有完整的正则表达式支持,功能更强大,而且速度更快。

1)纯批处理解决方案:MODFILE.BAT

我首先在 DOSTIPS 上发表了这篇文章:“终极”文件搜索和替换批处理实用程序

批处理函数可以用作独立的实用程序,也可以合并到更大的批处理脚本中。

假设该函数是名为 MODFILE.BAT 的文件中的独立实用程序,该文件位于当前文件夹中或 PATH 中的其他位置,那么您的脚本将变为:

@echo off
setlocal enableDelayedExpansion

set file="c:\Users\rawal\Desktop\a\file.txt"
set "OldStr=rise"
set "NewStr="
set /p "NewStr=Enter some text: "

call ModFile "%file%" OldStr NewStr

这是 ModFile 函数本身。完整的文档嵌入在脚本中。我煞费苦心地优化代码,并消除困扰大多数批处理解决方案的限制。但文档中列出了一些剩余的限制。

@echo off
:modFile File SearchVar [ReplaceVar] [/I]
::
::  Perform a search and replace operation on each line within File.
::
::  SearchVar = A variable containing the search string.
::
::  ReplaceVar = A variable containing the replacement string.
::               If ReplaceVar is missing or is not defined then the
::               search string is replaced with an empty string.
::
::  The /I option specifies a case insensitive search.
::
::  A backup of the original File is made with an extension of .bak
::  prior to making any changes.
::
::  The number of replacements made is returned as errorlevel.
::
::  If an error occurs then no changes are made and
::  the errorlevel is set to -1.
::
::  Limitations
::    - File must use Windows style line terminators <CR><LF>.
::    - Trailing control characters will be stripped from each line.
::    - The maximum input line length is 1021 characters.
::
setlocal enableDelayedExpansion

  ::error checking
  if "%~2"=="" (
    >&2 echo ERROR: Insufficient arguments
    exit /b -1
  )
  if not exist "%~1" (
    >&2 echo ERROR: Input file "%~1" does not exist
    exit /b -1
  )
  2>nul pushd "%~1" && (
    popd
    >&2 echo ERROR: Input file "%~1" does not exist
    exit /b -1
  )
  if not defined %~2 (
    >&2 echo ERROR: searchVar %2 not defined
    exit /b -1
  )
  if /i "%~3"=="/I" (
    >&2 echo ERROR: /I option can only be specified as 4th argument
    exit /b -1
  )
  if "%~4" neq "" if /i "%~4" neq "/I" (
    >&2 echo ERROR: Invalid option %4
    exit /b -1
  )

  ::get search and replace strings
  set "_search=!%~2!"
  set "_replace=!%~3!"

  ::build list of lines that must be changed, simply exit if none
  set "replaceCnt=0"
  set changes="%temp%\modFileChanges%random%.tmp"
  <"%~1" find /n %~4 "!_search:"=""!^" >%changes% || goto :cleanup

  ::compute length of _search
  set "str=A!_search!"
  set searchLen=0
  for /l %%A in (12,-1,0) do (
    set /a "searchLen|=1<<%%A"
    for %%B in (!searchLen!) do if "!str:~%%B,1!"=="" set /a "searchLen&=~1<<%%A"
  )

  ::count number of lines + 1
  for /f %%N in ('find /v /c "" ^<"%~1"') do set /a lnCnt=%%N+1

  ::backup source file
  if exist "%~1.bak" del "%~1.bak"
  ren "%~1" "%~nx1.bak"

  ::initialize
  set "skip=2"

  <"%~1.bak" (

    %=for each line that needs changing=%
    for %%l in (!searchLen!) do for /f "usebackq delims=[]" %%L in (%changes%) do (

      %=read and write preceding lines that don't need changing=%
      for /l %%N in (!skip! 1 %%L) do (
        set "ln="
        set /p "ln="
        if defined ln if "!ln:~1021!" neq "" goto :lineLengthError
        echo(!ln!
      )

      %=read the line that needs changing=%
      set /p "ln="
      if defined ln if "!ln:~1021!" neq "" goto :lineLengthError

      %=compute length of line=%
      set "str=A!ln!"
      set lnLen=0
      for /l %%A in (12,-1,0) do (
        set /a "lnLen|=1<<%%A"
        for %%B in (!lnLen!) do if "!str:~%%B,1!"=="" set /a "lnLen&=~1<<%%A"
      )

      %=perform search and replace on line=%
      set "modLn="
      set /a "end=lnLen-searchLen, beg=0"
      for /l %%o in (0 1 !end!) do (
        if %%o geq !beg! if %~4 "!ln:~%%o,%%l!"=="!_search!" (
          set /a "len=%%o-beg"
          for /f "tokens=1,2" %%a in ("!beg! !len!") do set "modLn=!modLn!!ln:~%%a,%%b!!_replace!"
          set /a "beg=%%o+searchLen, replaceCnt+=1"
        )
      )
      for %%a in (!beg!) do set "modLn=!modLn!!ln:~%%a!"

      %=write the modified line=%
      echo(!modLn!

      %=prepare for next iteration=%
      set /a skip=%%L+2
    )

    %=read and write remaining lines that don't need changing=%
    for /l %%N in (!skip! 1 !lnCnt!) do (
      set "ln="
      set /p "ln="
      if defined ln if "!ln:~1021!" neq "" goto :lineLengthError
      echo(!ln!
    )

  ) >"%~1"

  :cleanup
  del %changes%
exit /b %replaceCnt%

:lineLengthError
  del %changes%
  del "%~1"
  ren "%~nx1.bak" "%~1"
  >&2 echo ERROR: Maximum input line length exceeded. Changes aborted.
exit /b -1


2)混合JScript/批处理解决方案:REPL.BAT

我首先在 DOSTIPS 上发表了这篇文章:正则表达式批量搜索和替换 - 轻松编辑文件!

我真的很喜欢这个实用程序。大多数批处理脚本都是我的业余爱好,但我在日常工作中经常使用这个实用程序。它非常强大且快速,但需要很少的代码。它支持正则表达式搜索和替换,而且还具有/L文字选项。默认情况下,搜索区分大小写。

假设 REPL.BAT 位于当前文件夹中,或者位于 PATH 中的某个位置,那么您的代码将变为:

@echo off
setlocal enableDelayedExpansion

set "file=c:\Users\rawal\Desktop\a\file.txt"
set "OldStr=rise"
set "NewStr="
set /p "NewStr=Enter some text: "

type "%file%" | repl OldStr NewStr VL >"%file%.new"
move /y "%file%.new" "%file%" >nul

我用L强制文字搜索而不是默认正则表达式搜索的选项,以及V选项直接从环境变量读取搜索和替换值,而不是传递字符串文字。

这是实际的 REPL.BAT 实用程序。完整的文档嵌入在脚本中。

@if (@X)==(@Y) @end /* Harmless hybrid line that begins a JScript comment

::************ Documentation ***********
:::
:::REPL  Search  Replace  [Options  [SourceVar]]
:::REPL  /?
:::
:::  Performs a global search and replace operation on each line of input from
:::  stdin and prints the result to stdout.
:::
:::  Each parameter may be optionally enclosed by double quotes. The double
:::  quotes are not considered part of the argument. The quotes are required
:::  if the parameter contains a batch token delimiter like space, tab, comma,
:::  semicolon. The quotes should also be used if the argument contains a
:::  batch special character like &, |, etc. so that the special character
:::  does not need to be escaped with ^.
:::
:::  If called with a single argument of /? then prints help documentation
:::  to stdout.
:::
:::  Search  - By default this is a case sensitive JScript (ECMA) regular
:::            expression expressed as a string.
:::
:::            JScript regex syntax documentation is available at
:::            http://msdn.microsoft.com/en-us/library/ae5bf541(v=vs.80).aspx
:::
:::  Replace - By default this is the string to be used as a replacement for
:::            each found search expression. Full support is provided for
:::            substituion patterns available to the JScript replace method.
:::            A $ literal can be escaped as $$. An empty replacement string
:::            must be represented as "".
:::
:::            Replace substitution pattern syntax is documented at
:::            http://msdn.microsoft.com/en-US/library/efy6s3e6(v=vs.80).aspx
:::
:::  Options - An optional string of characters used to alter the behavior
:::            of REPL. The option characters are case insensitive, and may
:::            appear in any order.
:::
:::            I - Makes the search case-insensitive.
:::
:::            L - The Search is treated as a string literal instead of a
:::                regular expression. Also, all $ found in Replace are
:::                treated as $ literals.
:::
:::            B - The Search must match the beginning of a line.
:::                Mostly used with literal searches.
:::
:::            E - The Search must match the end of a line.
:::                Mostly used with literal searches.
:::
:::            V - Search and Replace represent the name of environment
:::                variables that contain the respective values. An undefined
:::                variable is treated as an empty string.
:::
:::            M - Multi-line mode. The entire contents of stdin is read and
:::                processed in one pass instead of line by line. ^ anchors
:::                the beginning of a line and $ anchors the end of a line.
:::
:::            X - Enables extended substitution pattern syntax with support
:::                for the following escape sequences:
:::
:::                \\     -  Backslash
:::                \b     -  Backspace
:::                \f     -  Formfeed
:::                \n     -  Newline
:::                \r     -  Carriage Return
:::                \t     -  Horizontal Tab
:::                \v     -  Vertical Tab
:::                \xnn   -  Ascii (Latin 1) character expressed as 2 hex digits
:::                \unnnn -  Unicode character expressed as 4 hex digits
:::
:::                Escape sequences are supported even when the L option is used.
:::
:::            S - The source is read from an environment variable instead of
:::                from stdin. The name of the source environment variable is
:::                specified in the next argument after the option string.
:::

::************ Batch portion ***********
@echo off
if .%2 equ . (
  if "%~1" equ "/?" (
    findstr "^:::" "%~f0" | cscript //E:JScript //nologo "%~f0" "^:::" ""
    exit /b 0
  ) else (
    call :err "Insufficient arguments"
    exit /b 1
  )
)
echo(%~3|findstr /i "[^SMILEBVX]" >nul && (
  call :err "Invalid option(s)"
  exit /b 1
)
cscript //E:JScript //nologo "%~f0" %*
exit /b 0

:err
>&2 echo ERROR: %~1. Use REPL /? to get help.
exit /b

************* JScript portion **********/
var env=WScript.CreateObject("WScript.Shell").Environment("Process");
var args=WScript.Arguments;
var search=args.Item(0);
var replace=args.Item(1);
var options="g";
if (args.length>2) {
  options+=args.Item(2).toLowerCase();
}
var multi=(options.indexOf("m")>=0);
var srcVar=(options.indexOf("s")>=0);
if (srcVar) {
  options=options.replace(/s/g,"");
}
if (options.indexOf("v")>=0) {
  options=options.replace(/v/g,"");
  search=env(search);
  replace=env(replace);
}
if (options.indexOf("l")>=0) {
  options=options.replace(/l/g,"");
  search=search.replace(/([.^$*+?()[{\\|])/g,"\\$1");
  replace=replace.replace(/\$/g,"$$$$");
}
if (options.indexOf("b")>=0) {
  options=options.replace(/b/g,"");
  search="^"+search
}
if (options.indexOf("e")>=0) {
  options=options.replace(/e/g,"");
  search=search+"$"
}
if (options.indexOf("x")>=0) {
  options=options.replace(/x/g,"");
  replace=replace.replace(/\\\\/g,"\\B");
  replace=replace.replace(/\\b/g,"\b");
  replace=replace.replace(/\\f/g,"\f");
  replace=replace.replace(/\\n/g,"\n");
  replace=replace.replace(/\\r/g,"\r");
  replace=replace.replace(/\\t/g,"\t");
  replace=replace.replace(/\\v/g,"\v");
  replace=replace.replace(/\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}/g,
    function($0,$1,$2){
      return String.fromCharCode(parseInt("0x"+$0.substring(2)));
    }
  );
  replace=replace.replace(/\\B/g,"\\");
}
var search=new RegExp(search,options);

if (srcVar) {
  WScript.Stdout.Write(env(args.Item(3)).replace(search,replace));
} else {
  while (!WScript.StdIn.AtEndOfStream) {
    if (multi) {
      WScript.Stdout.Write(WScript.StdIn.ReadAll().replace(search,replace));
    } else {
      WScript.Stdout.WriteLine(WScript.StdIn.ReadLine().replace(search,replace));
    }
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用批处理搜索和替换区分大小写的字符串 的相关文章

  • Laravel 搜索关系

    我有两个相关的模型 我正在尝试在产品中进行搜索 并且仅显示实际搜索结果 而不是找到该产品的类别的所有产品 我不想搜索任何类别 因为无论搜索什么或找到什么 类别都会始终显示 Example I have the following categ
  • 如何用另一个响应替换窗口的 URL 哈希?

    我正在尝试使用替换方法更改哈希 URL document location hash 但它不起作用 function var anchor document location hash this returns me a string va
  • JavaScript 中的巨大字符串替换?

    我有一个小型 JavaScript 应用程序 可以解析用户放入浏览器中的文件 最近我发现一些非英语字符的问题 此处放置的文件类型使用 Windows 1252 字符集 因此诸如 实际上是通过 我必须将它们全部转换为正确的字符 例如 我得到S
  • 批处理脚本 - 逐行读取

    我有一个日志文件 我需要逐行读入并将该行传送到下一个循环 首先 我在一个单独的文件中 grep 日志文件中的 主 字 如 错误 以保持其较小 现在我需要获取单独的文件并逐行读取它 每行都需要进入另一个循环 在这些循环中我 grep 日志并将
  • 整个应用程序中的全局“搜索功能”

    在我的整个应用程序中 我希望搜索按钮执行单独的操作Activity 即 当我按下搜索按钮时 从应用程序中的任何位置调用一个单独的活动 有什么方法可以代替定义onSearchRequested 在每项活动中 我只是在一个地方配置它 例如Man
  • 如何迭代所有注册表项?

    我正在尝试迭代所有注册表项以查找 包含 并删除 jre1 5 0 14 值 有办法做到吗 下面的代码只是在特定键下找到jre1 5 0 14 我确实想迭代所有的键 顺便说一句 if 子句获取是否等于 jre1 5 0 14 但如果它包含 j
  • 通过批处理文件自动化 cygwin

    长话短说 我们有多个服务器 我们每晚都在其上运行 perflog 监控 我的工作是将这些日志转换为 csv 格式并将它们发送到我的电子邮件 这一点已经通过前员工编写的 sh 脚本实现了自动化 我想要自动化的是在 perfmon 日志记录之后
  • 替换除引号内的逗号之外的逗号

    Date Time Ref Sen ATN Flow PCB temp Status Battery BC 2015 04 23 12 30 00 779581 908043 15 254 49 31 0 100 2015 04 23 12
  • 如何从 SQL Server 2008 查询结果中删除“NULL”

    我有一个包含 59 列和超过 17K 行的表 很多行都有NULL在某些列中 我想删除NULL以便查询返回空白 而不是NULL 我可以运行一些更新功能来替换所有NULL with 使用 SQL Server 2008R2 Management
  • 为什么标签存在却提示“系统找不到指定的批次标签”?

    在 Windows XP 中运行批处理文件时 我发现随机出现的错误消息 系统找不到指定name of label的批次标签 标签当然存在 导致此错误的原因是什么 实际上 要实现这一点 你需要两个条件 批处理文件不得使用 CRLF 行结尾 您
  • Flutter - 更改 SearchDelegate 的搜索提示文本

    目前实施中SearchDelegate 没有更改提示文本的选项 当查询为空时 将显示搜索屏幕 Search 在查询字段中作为提示文本 提示文本当前在第 395 行定义如下 final String searchFieldLabel Mate
  • 一个批处理文件如何获取另一个批处理文件的退出代码?

    我有两个批处理文件 task bat and runtask bat The runtask batcalls task bat我想要runtask bat获取退出代码task bat到一个变量中 这怎么可能做到呢 任务 bat echo
  • 如何使用Windows任务计划程序执行cscript?

    问题 当我双击 bat 文件时 它会按预期执行 当我在 Windows 任务计划程序中安排它时 除了具有 cscript 的行之外 它都会执行 bat文件的内容 echo off cls cscript CSV To Excel vbs c
  • Hive 中的 CASE 语句

    好的 我有以下代码来用二进制标志标记表中具有最高 Month cd 的记录 Select t1 month cd t2 max month cd CASE WHEN t2 max month cd null then 0 else 1 en
  • 如何在命令提示符中仅显示具有备用数据流的文件

    我知道要在命令提示符中显示所有文件 如果有 的备用数据流 这是命令dir R 但是 如果我只想显示具有备用数据流的文件 该怎么办 dir s r findstr e DATA or dir r findstr e DATA 第一个将在所有子
  • 创建一个批处理文件来打开 Firefox,然后运行一个宏(等待它完成),然后运行另一个宏

    我在尝试着 1 加载火狐浏览器 2 运行 Iopus Imacro iim 等待完成 然后 3 运行下一个宏 到目前为止 我已经尝试过 start wait call 以及我在互联网上可以找到的许多其他建议 这就是我到目前为止所拥有的 运行
  • MySQL - 如何按相关性排序? INNODB表

    我在一个名为 cards 的 INNODB 表中有大约 20 000 行 所以 FULLTEXT 不是一个选项 请考虑这张表 id name description 1 John Smith Just some dude 2 Ted Joh
  • 使用批处理从文本文件中提取特定文本

    我正在尝试使用批处理代码从文本文件中提取特定文本 我需要从中提取数据的文件将有多行文本 并且行数会有所不同 这意味着指示器的位置也会发生变化 以下是文本文件的示例 File 1
  • C# 中的高级替换

    我喜欢用 C 替换 xml 字符串 中的一些属性 示例 XML
  • 我想知道像tineye.com这样的反向图像搜索服务是如何工作的......?

    像 TinEye 这样的反向图像搜索引擎如何工作 我的意思是进行图像搜索需要哪些参数 不知道 TinEye 是否使用这个 但是SURF http en wikipedia org wiki SURF是用于此目的的常用算法 在这里您可以看到一

随机推荐

  • 复制带有格式的文本 - iOS 6 NSAttributedString 到粘贴板

    如何以编程方式复制格式化文本 例如italic 来自 UITextView 这样当粘贴到另一个程序 例如邮件 时 格式将被保留 我假设正确的方法是将 NSAttributedString 复制到粘贴板 现在 我可以通过以下方式将常规字符串复
  • 带有 标记的数组类型不适用于 Swagger (swashbuckle.aspnetcore)

    我正在使用 swagger 文档的摘要和示例标签 我的标签有问题 当我使用 array 时 swagger 无法识别它 我使用 swashbuckle aspnetcore 包 Nuget 例子 DataContract public cl
  • 在 R 中绘制世界地图

    我正在尝试使用 R 可视化世界地图上国家 地区的一些数据ggplot2 我正在使用以下代码 示例 WorldData lt map data world df lt data frame region c Hungary Lithuania
  • sqlite 中的十六进制文字太大

    所以我想将 mysql 查询转换为 sqlite 其中有十六进制代码的图像 当我在 sqlite 浏览器中运行相同的查询时 它给了我一个错误 正确的方法是什么 Result hex literal too big 0x73616666726
  • 无法从另一个板条箱导入模块 - 未解决的导入

    我正在尝试写一个名为bar 结构看起来像这样 src bar rs lib rs My src lib rs看起来像这样 crate type lib crate name bar feature ip addr allow dead co
  • 在 Windows 上连接 Jenkins 代理失败并出现连接超时

    在 Windows 上连接 Jenkins 代理失败 并出现连接超时 环境 Windows 服务器 2003 R2 Java6 硕士 Linux 从属 Windows 我尝试将它作为 jnlp 和 java jar cmd 运行 但它始终失
  • 清单合并失败:Android Studio

    我不确定出了什么问题 我用谷歌搜索了一下 虽然这是关于匹配 sdk 版本的 它们的作用相同 如下 构建 gradle android compileSdkVersion 17 buildToolsVersion 19 0 1 default
  • 在MySQL中获取一个人的年龄

    我怎样才能在mysql中获得一个人的年龄 想象一下我有一张桌子member id member month member year现在我需要获取会员的年龄Months Say member month 1 and member year 2
  • 尝试捕获信号量的正确方法

    将信号量操作包装在 try catch 块中的正确方法是什么 如果获取操作在获取一定数量 但不是全部 请求的许可后被中断 会发生什么情况 你怎么知道要再次释放多少个 发布是否应该在 最终 块中进行 但是如果操作被中断 您是否可能会发布未获得
  • 使用变量时在 Excel 中通过 VBA 设置验证失败

    我正在尝试使用 VBA 设置一系列单元格的数据验证 我使用此代码收到运行时错误 1004 非常有用 应用程序定义或对象定义错误 With rngRangeToCheck Cells lrownum 1 Validation Delete A
  • 如何使用 Selenium ChromeDriver 和 Chrome 在自定义位置下载文件

    我想将 txt 和 pdf 文件下载到特定文件夹 但它只是将它们下载到另一个文件夹中 网站http demo automationtesting in FileDownload html 代码有问题还是我没有放置正确的文件夹位置 impor
  • 在 WooCommerce 中删除或隐藏“wc_add_notice”消息

    我用它来删除 WooCommerce 中的 购物车已更新 消息 add filter woocommerce add message return false 但仍显示 运费已更新 消息 我怎样才能删除这条消息 根据您的具体情况 在短代码
  • UITableView 的问题:继续收到此运行时错误无法识别的选择器

    我有这个错误 它阻碍了我前进 我基本上有一个应用程序 其中包含一个指向各个 UIViewController 的 UITabViewController 所以其中一个选项卡 我想实现一个基本的 TableViewController 现在
  • 用于运行 VSCode 扩展的自定义节点版本

    我正在制作一个 vscode 扩展供我个人使用 我真的很想使用更新的节点版本 但是 我不确定 VSCode 如何选择要使用的节点版本 我安装的唯一的node js是8 1 3 但是当我调试扩展时 我看到 VSCode 使用7 via pro
  • 在 yii 中使用 url 管理器将 url 更改为 seo 友好

    我如何将这些 URL 转换为 SEO 友好的 URL 我在 yii 中尝试了 Url manager 但没有得到正确的结果是否有关于 url manager 的好的教程 http localhost nbnd search city cit
  • 如何自动关闭PostgreSQL中的空闲连接?

    一些客户端连接到我们的 postgresql 数据库 但保持连接打开 是否可以告诉 Postgresql 在一定时间不活动后关闭这些连接 TL DR 如果您使用的是 Postgresql 版本 gt 9 2然后使用我想出的解决方案 如果你不
  • ASP.NET WebForms + Postback 然后打开弹出窗口

    我有一个 LinkBut ton 它必须回发才能执行某些逻辑 完成后 我不想在浏览器中加载页面 而是想保留它并弹出一个新窗口 到目前为止 我最好的想法是将 LinkBut ton 放入 UpdatePanel 中 并让它在重新加载时呈现一些
  • 使用 Gson 反序列化泛型集合

    我在使用 GSon 进行 json 反序列化时遇到一些困难 我希望有人可以帮助我 我想反序列化以下 json 片段 fieldA valueA myCollection AnotherClass objectAfieldA valueB o
  • 从 TCL 中的过程返回数组

    我想从过程中传递数组并返回数组 以下是我尝试的示例代码 但出现一些错误 set a 0 11 set a 1 10 set a 2 20 set a 3 30 set a 4 40 proc deleten somet upvar some
  • 如何使用批处理搜索和替换区分大小写的字符串

    我想搜索并替换区分大小写的字符串 就像如果我在文本文件中有rise Rise RISE 我只想替换字符串 rise 下面的代码是替换所有三个字符串 请帮助我 Echo on SETLOCAL ENABLEEXTENSIONS SETLOCA