China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-14 04:19
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » [Help] Looking for a command-line character replacement command View 1,228 Replies 1
Original Poster Posted 2005-03-05 00:00 ·  中国 福建 泉州 电信
银牌会员
★★★
Credits 1,276
Posts 469
Joined 2002-12-23 13:00
23-year member
UID 586
Gender Male
From 福建泉州
Status Offline
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!
QQ:366840202
http://chenall.net
Floor 2 Posted 2005-03-05 00:00 ·  中国 广东 广州 白云区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
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, “好吗”).
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Forum Jump: