Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何从要重定向到文本文件的批处理脚本中获取特定的标准输出_Batch File_Exit Code - Fatal编程技术网

Batch file 如何从要重定向到文本文件的批处理脚本中获取特定的标准输出

Batch file 如何从要重定向到文本文件的批处理脚本中获取特定的标准输出,batch-file,exit-code,Batch File,Exit Code,我有一个通过psftp发送文件的功能。在它发送数据后,我在终端中得到以下输出: Sent EOF Message Server send command exit status 0 Disconnected: All channels closed 我只需要将读取“服务器发送命令退出状态0”的行回荡到文件中。如有任何建议,将不胜感激 yourcommand | findstr /L /c:"Server send command exit status" >yourdestination

我有一个通过psftp发送文件的功能。在它发送数据后,我在终端中得到以下输出:

Sent EOF Message
Server send command exit status 0
Disconnected: All channels closed
我只需要将读取“服务器发送命令退出状态0”的行回荡到文件中。如有任何建议,将不胜感激

yourcommand | findstr /L /c:"Server send command exit status" >yourdestinationfilename

如果需要,可以使用
>
代替
进行追加,而不是重新创建。

如果您知道模式,可以用
C++
制作一个小程序,比如读取3行,只输出中心行吗?然后使用命令行上的
|
操作符从原始程序中输入输出。我是Linux/Bash高手。不是Windows的家伙。。。我想在这里为grep命令杀死什么…findstr不需要文件名吗?我需要从stdout中捕获一个特定元素