批处理文件:如果不是X%5 == X [英] Batch file: IF NOT X%5==X
问题描述
在批处理文件中,这是什么如果不是X%5 == X"?我知道这是一个if语句,%5是第五个参数. X%5是什么意思?并将其与X相比意味着什么?
我已经很久没有写过DOS批处理文件了:),但我认为它也类似于Unix shell脚本中使用的一种技术:表达式X%5==X
计算如果第五个参数不存在,则为true,即传递给脚本的参数少于5个.外壳程序(command.com或其他命令)将%5
替换为参数,如果提供的参数少于5个,则该字符串为空字符串,从而将表达式减少为X==X
(因此:true).
In a batch file, what is this "IF NOT X%5==X"? I know it's an if statement and %5 is the fifth argument. What does X%5 mean? And what does it mean to compare it to X?
I haven't written a DOS batch file for ages :) but I think it resembles a technique used in Unix shell scripts as well: expression X%5==X
evaluates to true if the fifth parameter doesn't exist, i.e. there is less then 5 parameters passed to the script. The shell (command.com or whatever) replaces %5
with the parameter, which is an empty string if less then 5 parameters were supplied, which reduces the expression to X==X
(so: true).
这篇关于批处理文件:如果不是X%5 == X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!