![]() |
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-13 23:47 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS学习入门 & 精彩文章 (教学室) » Question about whether batch files have the concept of data types? |
| Printable Version 1,054 / 3 |
| Floor1 jeady | Posted 2006-04-12 14:40 |
| 新手上路 Posts 2 Credits 8 | |
|
Newbie question, as the title says........
I want to implement something like 1+1=2,, how do you do addition, subtraction, multiplication, and division in a batch file??? |
|
| Floor2 Jnwei1202 | Posted 2006-04-12 16:56 |
| 初级用户 Posts 33 Credits 197 | |
|
On 2000 and XP systems you can use the SET command
|
|
| Floor3 jeady | Posted 2006-04-12 17:04 |
| 新手上路 Posts 2 Credits 8 | |
|
Thanks to Jnwei1202 for the reply. Can you give an example?
@set myvar=1+1 @echo %myvar% What it outputs is 1+1......... |
|
| Floor4 JonePeng | Posted 2006-04-12 20:54 |
| 金牌会员 Posts 1,883 Credits 4,562 From 广东广州 | |
|
The set command should use the "/a" parameter, for example: set /a myvar=1+1
This parameter only works under Win2000/XP/2003 systems. The SET command is very powerful, and there are a lot of related posts on the forum. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |