Send text to standard input of a Windows console app

感情迁移 提交于 2019-12-03 16:11:17

The usual way to do this in .bat files is to use echo to write a small text file, then redirect the text file to standard in of the command.

@echo foo > bar.txt
@echo if you need multiple lines >> bar.txt

the_cmd < bar.txt

In your specific example it would something like

copy myfile.txt bar.txt
@echo %variable% >> bar.txt

The fact that you are mention $(variable) suggests to me that this is a makefile rather than a batch file. for a makefile, theres a better way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!