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-07-02 08:27
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » The Dilemma of SET View 3,760 Replies 9
Original Poster Posted 2004-07-04 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
SET a=1
SET b=2
SET c=a+b

In BASIC, the value of C would be 3, but batch processing can't do that.

I've tried ASET, XSET, STRINGS and none worked (they only support direct numeric operations)

Is there any other small tool that can solve "arithmetic operations between variables"?
DOS之家 http://doshome.com 站长 葛明阳
Floor 2 Posted 2004-07-05 00:00 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
If it is the DOS mode of Windows 2000/xp/2003, you can use:
set /a c=a+b

As for the pure DOS environment, you can use Horst's varset.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2004-07-05 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
Thanks, going home to try it out.
Also, CLIMBING? It's the moderator of Wuyou! Long time no see!
DOS之家 http://doshome.com 站长 葛明阳
Floor 4 Posted 2004-07-06 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
gmy, in fact, STRINGS can also be done, for example:

SET A=1
SET B=2
STRINGS C=ADD %A%,%B%
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 5 Posted 2004-07-09 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
to Wengier

STRINGS C=ADD %A%,%B%

It doesn't seem to work. I tried. If it's:

STRINGS C=ADD 1,2

It's okay. STRINGS doesn't support variable forms (%X%)
DOS之家 http://doshome.com 站长 葛明阳
Floor 6 Posted 2004-07-09 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
### to Climbing

VARSET Success! Thank you! The specific steps are:

set a=1
set b=2
call var set c=%a%,%b%

Then press ENTER after SET
C=3
DOS之家 http://doshome.com 站长 葛明阳
Floor 7 Posted 2004-07-09 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
gmy, who said STRINGS doesn't support variable form? I did an experiment before replying, and it proved that it's absolutely feasible before posting it. In fact, there is no question of whether STRINGS supports environment variables at all, but it depends on whether DOS supports it, because after entering the environment variable, DOS automatically converts the environment variable into its actual value and hands it to the program for use, either because the usage method is wrong. Note: I tested it under the pure MS-DOS 7.10 command line.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 8 Posted 2004-07-10 00:00 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
STRINGS is what command? Forgive me for being ignorant, I'm seeing this command for the first time, and I've learned something new!

Is this command only usable under DOS 7.10? I didn't find this command in the DOS mode of 2003. Why does Microsoft keep changing things like this?

Also, I think varset is more universal because it can be used in any DOS environment.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 9 Posted 2004-07-10 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
In fact, both Strings and Varset are external tools, not built-in with DOS. It's just that Varset was written by Horst, while Strings was written by Dunglas and has more functions. Both can be downloaded in the "Script Tools" section of the website. Since the LZ mentioned Strings in the post, I'll explain that Strings can do it (Varset can certainly do it too).
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 10 Posted 2010-09-01 22:50 ·  中国 北京 联通
初级用户
Credits 21
Posts 8
Joined 2010-08-24 12:56
15-year member
UID 172902
Gender Male
Status Offline
Strings are indeed great things!!!
Forum Jump: