天天看點

DOS批進行中文本替換

在DOS批進行中要将某一行中的部分文字替換掉, 今天找到辦法了.

set str=hello, this is a test, replace some characters using dos command
rem 将小寫開頭的hello替換為大寫開頭的Hello
set str2=%str:hello=Hello%
echo %str%
echo %str2%
           

得到的結果為:

hello, this is a test, replace some characters using dos command
Hello, this is a test, replace some characters using dos command