集合 /p 中的 /p 是什么意思



/pset /p=中代表什么?我知道/启用开关,而且我相当确定我知道/a适用于arithmetic。我听过很多谣言,有人说/pprompt,有人说它代表print。我有点怀疑它是否prompt的唯一原因是因为在许多情况下,它不会要求提示,而是在屏幕上打印,例如

<nul set /p=This will not generate a new line

但我想知道的是:我们真的知道它代表什么吗?

/P开关允许您将变量的值设置为用户输入的输入行。 在读取输入行之前显示指定的提示字符串。 提示字符串可以为空。

我用的两种方式...第一:

SET /P variable=

当批处理文件达到此点(留空时)时,它将停止并等待用户输入。然后输入变为可变。

第二:

SET /P variable=<%temp%filename.txt

将变量设置为 txt 文件的内容(第一行)。除非包含/P否则此方法不起作用。两者都在Windows 8.1 Pro上进行了测试,但在7和10上是相同的。

为了将来参考,您可以使用 /? 开关获取任何命令的帮助,该开关应说明哪些开关执行哪些操作。

根据set /?屏幕,set /p的格式是SET /P variable=[promptString],这将表明/p中的p是"提示"。 它只是在您的示例中打印,因为<nul传入一个 nul 字符,该字符会立即结束提示,因此它就像在打印一样。从技术上讲,它仍然提示输入,它只是立即接收它。


注意:此点以下的答案适用于该问题的先前版本。

/L in for /L 生成一个 List 的数字。

ping /?

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
            [-r count] [-s count] [[-j host-list] | [-k host-list]]
            [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name
Options:
    -t             Ping the specified host until stopped.
                   To see statistics and continue - type Control-Break;
                   To stop - type Control-C.
    -a             Resolve addresses to hostnames.
    -n count       Number of echo requests to send.
    -l size        Send buffer size.
    -f             Set Don't Fragment flag in packet (IPv4-only).
    -i TTL         Time To Live.
    -v TOS         Type Of Service (IPv4-only. This setting has been deprecated
                   and has no effect on the type of service field in the IP Header).
    -r count       Record route for count hops (IPv4-only).
    -s count       Timestamp for count hops (IPv4-only).
    -j host-list   Loose source route along host-list (IPv4-only).
    -k host-list   Strict source route along host-list (IPv4-only).
    -w timeout     Timeout in milliseconds to wait for each reply.
    -R             Use routing header to test reverse route also (IPv6-only).
    -S srcaddr     Source address to use.
    -4             Force using IPv4.
    -6             Force using IPv6.

最新更新