批处理数学(Win) [英] Math on batch (win)

查看:75
本文介绍了批处理数学(Win)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发CMD批次.我想在其中做一些数学运算.此公式:(x+1)100:y

I am developing a CMD batch. I want to do some math in it. This formula: (x+1)100:y

所以批量x = %x%, and y = %y%.我知道如何设置变量.现在,如何批量计算呢? (WINDOWS CMD)

So in batch, x = %x%, and y = %y%. I know how to set the variables. Now, how can batch calculate this? (WINDOWS CMD)

我需要一些额外的东西吗?

Do I need something extra?

(我需要Windows XP到7的用户可以使用它.)

(I need this to be available to users of Windows XP to 7.)

推荐答案

set命令支持一些有限的计算.您的情况是: set /a result=(100*x)/y

The set command supports some limited calculation. In your case, you want: set /a result=(100*x)/y

运行set /?以查看有关受支持内容的完整文档. /a开关执行自动变量替换,因此您可以使用x代替%x%.

Run set /? to see full documentation on what is supported. The /a switch does automatic variable substitution, so you can use x instead of %x%.

这篇关于批处理数学(Win)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆