批处理中“/ p”,“/ a”和“/ i”之间有什么区别?

时间:2017-07-11 21:59:18

标签: batch-file

我现在感觉很愚蠢,因为我试图批量编写一个很长的程序,而我刚刚发现我对该语言的了解程度很低。我在许多建议的解决方案中看到的一件事是命令,例如set,然后是/p或类似的命令。到目前为止,我已经看到/p/a/i。我已经看到了问他们代表什么的问题,我对/p的作用有所了解,但是所有这些都做了什么,还有我应该知道的更多/(letter)命令吗? / p>

1 个答案:

答案 0 :(得分:0)

来自help set的结果:

The /A switch specifies that the string to the right of the equal sign
is a numerical expression that is evaluated.  The expression evaluator
is pretty simple and supports the following operations, in decreasing
order of precedence:

    ()                  - grouping
    ! ~ -               - unary operators
    * / %               - arithmetic operators
    + -                 - arithmetic operators
    << >>               - logical shift
    &                   - bitwise and
    ^                   - bitwise exclusive or
    |                   - bitwise or
    = *= /= %= += -=    - assignment
      &= ^= |= <<= >>=
    ,                   - expression separator
If you use any of the logical or modulus operators, you will need to
enclose the expression string in quotes.  Any non-numeric strings in the
expression are treated as environment variable names whose values are
converted to numbers before using them.  If an environment variable name
is specified but is not defined in the current environment, then a value
of zero is used.  This allows you to do arithmetic with environment
variable values without having to type all those % signs to get their
values.  If SET /A is executed from the command line outside of a
command script, then it displays the final value of the expression.  The
assignment operator requires an environment variable name to the left of
the assignment operator.  Numeric values are decimal numbers, unless
prefixed by 0x for hexadecimal numbers, and 0 for octal numbers.
So 0x12 is the same as 18 is the same as 022. Please note that the octal
notation can be confusing: 08 and 09 are not valid numbers because 8 and
9 are not valid octal digits.

The /P switch allows you to set the value of a variable to a line of input
entered by the user.  Displays the specified promptString before reading
the line of input.  The promptString can be empty.

据我所知,没有/我打开set命令。