为什么 -c 选项不起作用? (平选项)

Why -c option does not work? (ping option)

我想做一件非常简单的事情:ping 一台机器。问题是我只想做一次。我做了一些研究,发现 -c 选项正是我所需要的。但是由于我不明白的原因,我的终端无法识别它...它说 "invalid option",这怎么可能?

我在 Windows 7 Enterprise 机器上使用 Cygwin。

看起来您使用的是 Windows ping 二进制文件,而不是 linux 的。 http://www.computerhope.com/pinghlp.htm

考虑为 Windows' 二进制文件使用适当的选项(在你的情况下我认为它是 -n

您可以将-c 替换为-n。 In linux 你可以使用-c,但是在Windows 和使用cygwin 时,你可以使用-n。 heresppinduxmmpgepfpindg`

     -a     Audible ping.
     -A     Adaptive  ping.  Interpacket interval adapts to round-trip time,
          so that effectively not more than one (or more,  if  preload  is
          set)  unanswered probe is present in the network. Minimal inter‐
          val is 200msec for not super-user.  On  networks  with  low  rtt
          this mode is essentially equivalent to flood mode.

   -b     Allow pinging a broadcast address.

   -B     Do  not  allow  ping  to  change  source address of probes.  The
          address is bound to one selected when ping starts.

   -c count
          Stop after sending count  ECHO_REQUEST  packets.  With  deadline
          option, ping waits for count ECHO_REPLY packets, until the time‐
          out expires.

‖‖在 linux -c countcygwin 中选项是 -n count