中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-14 05:07
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » [Help] Looking for a command-line character replacement command
Printable Version  1,230 / 1
Floor1 chenall Posted 2005-03-05 00:00
银牌会员 Posts 469 Credits 1,276 From 福建泉州
I remember seeing a piece of software like this somewhere before, but I forgot its name (I'll use REPLACE for it for now). Its function is roughly like this:
For example, I have a variable TEST=How are you
Now I want to change "How" to "Good evening" but keep the value of TEST unchanged.
Is there such a command?
I remember there was such a command, but I've forgotten it.
It seemed to be like this:
replace %test%,"How","Good evening"
I don't remember the details clearly either,
If anyone has seen a command like this, please tell me. Thanks!
Floor2 JonePeng Posted 2005-03-05 00:00
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Replace seems to be the NT system command for replacing files, right? You should use the Strings command (it's on Wengier's MSDOS 7.1 boot disk):strings xyz=right %test%,4set test=Good evening%xyz%In the first command, the right parameter of Strings is used to put the rightmost four characters of %test% into the variable xyz. Since one Chinese character is made up of two characters, to extract “好吗” you need to extract 4 characters. Then use the SET command to combine “Good evening” and %xyz% (that is, “好吗”).
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023