使用批处理文件将命令发送到另一个程序 [英] send command to another program with batch file

查看:298
本文介绍了使用批处理文件将命令发送到另一个程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

例如我有一个.bat文件如下:

 @ ECHO OFF 
cd / d D:\
anApp.exe
sthcmd D:\ abc.text



现在我想向anApp.exe发送命令
我这样做:

 C:\> cd / d D:\ 
D: \> anApp.exe
AnApp> sthcmd D:\ abc.text



但是当与.bat文件一起使用时,它工作到第3行和只需运行anApp.exe并且不要将sthcmd发送到anApp.exe

如何使用.bat文件执行此操作?

解决方案

尝试:

 @ ECHO OFF 
cd / d D:\
ECHO sthcmd D:\ abc.text | anApp.exe


Hi.
for example I have a .bat file such as this :

@ECHO OFF
cd /d D:\
anApp.exe
sthcmd D:\abc.text


now I want send command to anApp.exe
in cmd window I do this like this :

C:\>cd /d D:\
D:\>anApp.exe
AnApp>sthcmd D:\abc.text


but when do taht with .bat file it work to line 3 and just run anApp.exe and dont send sthcmd to anApp.exe
how can I do that with .bat file ?

解决方案

Try:

@ECHO OFF
cd /d D:\
ECHO sthcmd D:\abc.text | anApp.exe


这篇关于使用批处理文件将命令发送到另一个程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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