Windows批处理脚本:将文本传递到命令行应用程序 [英] Windows batch script: Pipe text into a command line application

查看:79
本文介绍了Windows批处理脚本:将文本传递到命令行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个批处理脚本来自动化一些3D打印过程.现在,我的代码如下:

I'm writing a batch script to automate some 3D printing processes. Right now, my code looks like this:

echo connect COM5 230400>3dprint.txt
echo load 3dprint01.gcode>>3dprint.txt
echo print>>3dprint.txt
type 3dprint.txt | C:\Printrun\pronsole.exe

因此Pronsole是一个命令行应用程序,它接受用户输入的命令(如上面的connect,load和print).上面,我已经使批处理文件创建了一个文本文件,并将其传递到应用程序中-除非它碰到EOF,否则会导致Pronsole崩溃.

So Pronsole is a command-line application that takes user-inputted commands (like connect, load and print above). Above, I've made the batch file create a text file and pass that into the application - except when it hits the EOF, this causes pronsole to crash.

是否有其他方法可以将(stdin样式)文本传递给不发送EOF的此命令行应用程序?

NB.文本命令也不需要一次全部发送,但是我想用管道将每一行都发送会导致每次打开一个新的pronsole.exe实例吗?

NB. The text commands don't all need to be sent at once either, but I imagine piping each line would cause a new instance of pronsole.exe to be opened each time?

推荐答案

AFAIAA的 3dprint.txt 末尾根本没有 EOF .

There simply isn't an EOF at the end of 3dprint.txt AFAIAA.

无论哪种情况,我都会尝试在 pronsole.exe exit 命令后添加一行. EXIT QUIT

I'd try appending a line with the exit command for pronsole.exe, whatever that is. EXIT maybe, or QUIT

这篇关于Windows批处理脚本:将文本传递到命令行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆