在bat脚本参数中找到模数

时间:2017-10-19 11:50:39

标签: batch-file

@ECHO OFF 
:Loop 
IF "%1"=="" GOTO completed 
FOR %%F IN (%1) DO IF "%%F"%3==0 echo %%F 
SHIFT 
GOTO Loop 
:completed

我编写此代码用于在Windows中使用批处理脚本检查数组中的数据。 在cmd上运行此.bat文件

screenshot

但是可以被3整除的值

1 个答案:

答案 0 :(得分:3)

你有几个问题。首先,您不需要;with cte_qry1 as ( select distinct sysnam,count(*) as High from tablename where Label00002 = '1.High' and Item_grade = 'NON-COMPLIANT' group by sysnam ) cte_qry2 as ( select distinct sysnam,count(*) as Medium from tablename where Label00002 = '2.Medium' and Item_grade = 'NON-COMPLIANT' group by sysnam ) select cte_qry1.sysnam, High, Medium from cte_qry1 inner join cte_qry2 on cte_qry1.sysnam = cte_qry2.sysnam 循环和for循环来循环遍历脚本参数。选一个。接下来,goto语句无法执行数学运算。他们无法计算模数。您必须使用if来计算模数(num%3)。

这是一个有效的例子。

set /a