windows 如何在 cmd 批处理文件中运行另一个命令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7743105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I run another command in a cmd batch file?
提问by Matt Elhotiby
I have this command that i need to run
我有这个命令需要运行
cd /d C:\leads\ssh & C:\Windows\System32\cmd.exe /E:ON /K C:\Ruby192\bin\setrbvars.bat
this opens the command prompt
这将打开命令提示符
but I need to run this command in the prompt
但我需要在提示符下运行这个命令
ruby C:\lead\leads.rb
which will fire off a script.....but i have no idea what to add to my bat file to do this
这将触发一个脚本......但我不知道要添加到我的 bat 文件中来执行此操作
i tried the -f flag to tell it to run the command but no go....any ideas to what to do to make this run
我尝试了 -f 标志来告诉它运行命令,但没有去......任何想法如何运行
cd /d C:\leads\ssh & C:\Windows\System32\cmd.exe /E:ON /K C:\Ruby192\bin\setrbvars.bat -f ruby C:\lead\leads.rb
pause
回答by wimh
Try the following batch file:
尝试以下批处理文件:
@echo off
cd /d C:\leads\ssh
call C:\Ruby192\bin\setrbvars.bat
ruby C:\lead\leads.rb