gpt4 book ai didi

windows - "The process tried to write to a nonexistent pipe." bat 文件

转载 作者:行者123 更新时间:2023-12-03 11:10:49 26 4
gpt4 key购买 nike

我可以在命令行上运行这个循环:

for /f "tokens=2" %i in ('arp -a ^| Find/i "dynamic"') do echo %i

但是如果我运行同一个 bat 文件,我会得到:

^C^C^C^Cthe process tried to write to a nonexistent pipe^C^C^C^C^C^C^C^C^

C:\1\test.bat:

for /f "tokens=2" %%i in ('arp -a ^ |Find/i "dynamic"') do echo %%i

由您的 arp -a 命令返回:

C:\Users\test>arp -a
Interface: xxx.xx.xxx.40 --- 0xbe
Internet Address Physical Address
xxx.xx.xxx.18 xx-xx-xx-xx-xx-xx dynamic
xxx.xx.xxx.26 xx-xx-xx-xx-xx-xx dynamic
xxx.xx.xxx.34 xx-xx-xx-xx-xx-xx dynamic
xxx.xx.xxx.114 xx-xx-xx-xx-xx-xx dynamic

感谢您的帮助//Simon

最佳答案

您在竖线 | 之前引入了一个额外的空白字符。插入符号 ^ 因此具有转义空格的效果,并且管道没有按应有的方式转义。

@For /F "Tokens=2" %%i In ('arp -a ^| Find /I "dynamic"') Do @(Echo %%i)>>"%~dp0output.txt"

关于windows - "The process tried to write to a nonexistent pipe." bat 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48318204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com