简体   繁体   English

如何在Windows中执行命令行输出而不必生成bat文件?

[英]How can I execute command line output in windows without having to generate a bat file?

I did a little script to pull the latest of all my subrepos in Mercurial (without updating them) for a very particular experiment (integrating with another VCS whose repo I had to break in different subrepos) that requires all subrepos in sync. 我做了一个小脚本,将Mercurial中所有子存储库的最新信息(不更新它们)进行了一个非常特殊的实验(与我不得不中断其子存储库的另一个VCS集成),要求所有子存储库都同步。

For this, a first step is the following command: 为此,第一步是以下命令:

cat .hgsubstate|sed -r s:^\w+\s(.*):\1:g|sed -r s:(.*):'hg pull -R \1 perforce':g

That gives me as output all the commands I have to execute line by line, however I'm in windows and there is no eval to pipe them to (I have cygwin): 这使我可以逐行执行所有命令,但我在Windows中,并且没有评估将它们传递到的命令(我有cygwin):

hg pull -R apps/canservice perforce
hg pull -R apps/hmi perforce
hg pull -R apps/lua perforce

I don't want to have to generate a bat file, execute it and then delete it, so, is there any alternative for doing this in a single blow? 我不想生成一个bat文件,执行它然后删除它,因此,有没有其他选择可以一击完成?

过去这对我有用

foo | bar | cmd.exe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows bat文件如何验证命令输出 - Windows bat file how to verify output of a command 如何从Windows命令行执行外部PHP文件(bat文件) - How to execute an external PHP file from a Windows Command Line (bat file) 如何使用 windows 命令行下载文件而无需输入代理密码? - How do I download a file using windows command line without having to input a proxy password? 如何从Windows命令行生成Bcrypt哈希 - How can I generate a Bcrypt hash from the Windows command line 如何使用bat文件响应命令行提示符(Windows) - How to respond to command line prompt using bat file (Windows) 如何在命令中使用文件并将 output 重定向到同一个文件而不截断它(Windows)? - How can I use a file in a command and redirect output to the same file without truncating it (Windows)? 如何使用 C 在 Windows 中执行批处理 (.bat) 文件 - How to execute batch (.bat) file in Windows with C 如何从Windows命令行运行python文件(.py)而不必先键入python? - How to run a python file (.py) from the windows command-line without having to type python first? 如何在 Windows 的命令行中创建一个空文件? - How can I create an empty file at the command line in Windows? 如何更改 Windows 中文件的所有者(命令行) - How can I change the owner of a file in Windows (command line)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM