中国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-09-30 22:52
47,813 topics / 349,918 posts / today 0 new / 48,279 members
DOS学习入门 & 精彩文章 (教学室) » Problems with PING
Printable Version  2,622 / 19
Floor16 hxmupdata Posted 2007-03-12 07:02
初级用户 Posts 39 Credits 76
For count-1, if count=%count%-1, then it is 10-1
1: What is the difference between global and local for the environment variables defined by set?
2: Can the environment variable string contain any symbols?
set %count%=count-1 is set 10=count-1
Here, is 10 a variable? The result of echo %10% is echo 0. I don't understand 0 here.....

Note:
Display, set, or delete environment variables. If there are no parameters, the set command will display the current environment settings.

Syntax
set ] ] string]

Parameters
/a
Set string to an evaluable numeric expression.
/p
Set the value of variable to an input line.
variable
Specifies the variable to be set or modified.
string
Specifies the string to be associated with the specified variable.
/?
Displays help at the command prompt.
Floor17 hxmupdata Posted 2007-03-12 07:18
初级用户 Posts 39 Credits 76
10 is a variable but %10% is ambiguous... So how to improve it???? Can the variable defined by set contain an = sign? How to do it??
Floor18 hxmupdata Posted 2007-03-12 07:19
初级用户 Posts 39 Credits 76
What are the points to pay attention to when using the %???????????????
Floor19 bjsh Posted 2007-03-16 00:25
银牌会员 Posts 621 Credits 2,000
Floor20 lxmxn Posted 2007-03-16 00:38
版主 Posts 4,938 Credits 11,386

  Re hxmupdata:

  Regarding the usage of set: If set is used without the /a parameter, it means direct assignment, that is, the value after the = sign is directly assigned to the variable before the = sign. If you want to use set for simple arithmetic operations, you must add the /a parameter because the /a parameter specifies that set is for arithmetic operations. For example, set a=1+7, then the value of variable a is "1+7". Adding the /a parameter can calculate the arithmetic expression after the = sign. For example, set /a a=1+7, then the value of variable a is 8. If you want to reference this variable, you need to enclose the variable a with %, for example, echo %a%, so that the value of variable a can be displayed.

  In addition, there can be "=" signs in variables. For example, set str=a=b=c, then the result of echo %str% is "a=b=c".
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023