当我将 Windows 二进制文件(如 ping 或 netstat)复制到机器上的其他位置时,我无法获得任何输出。
例子:
>C:\Windows\System32\ping.exe 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
>copy C:\Windows\System32\ping.exe n_ping.exe
1 file(s) copied.
>n_ping.exe 127.0.0.1
>n_ping.exe 127.0.0.1 > test.out
>type test.out
>move n_ping.exe ping.exe
>.\ping.exe 127.0.0.1
>
问题:
n_ping 命令没有输出,但我在 Wireshark 中看到 ICMP 流量。
有没有办法获取在 Windows 文件夹外运行的二进制文件(如 ping 和 netstat)的输出?
答案1
通过在执行二进制文件的同一文件夹中创建包含 mui 文件的 en-US 文件夹来解决(感谢@gronostaj -为什么 DNS 显然参与在 Windows 10 上发布“dir”?)
>mkdir en-US
>copy %windir%\System32\en-US\ping.exe.mui .\en-US\
1 file(s) copied.
>.\ping.exe 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms