我可以在bat文件中运行两个单独的文件吗? [英] Can I run two separate files in a bat file?

查看:130
本文介绍了我可以在bat文件中运行两个单独的文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想知道我是否可以运行2个cmd提示并完全执行我的程序.在运行pythonScriptTemplate.py之前,我需要seleniumServer.jar在后台运行.

这是我的.bat文件代码:

开始
cd C:\ Users \ Colton \ Project
java -jar selenium-server.jar
暂停

开始
cd C:\ Users \ Colton \ Project
python seleniumScriptTemplate.py
暂停


这不起作用,它将打开两个cmd提示,并且第一个提示运行selenium.但是,第二个命令什么也没做,只是将我的路径更改为.bat文件中的路径...有任何建议吗?

So I am wondering if I can run 2 cmd prompts and execute my program completely. I need the seleniumServer.jar to run in the background before i run my pythonScriptTemplate.py.

here is my code for the .bat file:

start
cd C:\Users\Colton\Project
java -jar selenium-server.jar
pause

start
cd C:\Users\Colton\Project
python seleniumScriptTemplate.py
pause


this does not work, it opens two cmd prompts, and the first one runs selenium. however, the second one does nothing but change my path to the path in the .bat file... any suggestions?

推荐答案

难怪!

不要停顿,这是没有意义的.不要在cd中使用start,而在应用程序中使用它:

No wonder!

Don''t pause, it makes not sense. Don''t use start in cd, use it on application:

cd C:\Users\Colton\Project
start java -jar selenium-server.jar

cd C:\Users\Colton\Project
start python seleniumScriptTemplate.py



更确切地说,我不确定您的应用程序是否为控制台.我宁愿假设pytnon在控制台上运行.这几乎可以肯定.然后执行以下操作:




More exactly, I don''t know for sure if your applications are console or not. I would rather assume pytnon runs on a console. This is almost certain. Then do this:


cd C:\Users\Colton\Project
start java -jar selenium-server.jar

cd C:\Users\Colton\Project
python seleniumScriptTemplate.py



您将启动一个应用程序,然后将另一个应用程序带入控制台.

而已!有关如何获取更多信息,请参阅我的其他答案.

—SA



You will start one application and bring another on console.

That''s it! See my other Answer on how to get more information.

—SA


我的具体答案之外:学一点点批处理编程,永远不会受伤.
用我的方式来获取有关该主题的完整参考.

运行该批处理以生成可用帮助的文档:

帮助生成器—批处理文件.

这不是我的工作.抱歉,暂时无法告诉作者;应该在我的记录中.

—SA
An addition to my concrete answer: learn just a bit of batch programming, it will never hurt.
Use my way to get complete reference on the topic.

Run this batch to generate the documentation our of available help:

Help generator — batch file.

This is not my work. Sorry, cannot tell the author right now; should be somewhere on my records.

—SA


四肢走动...不使用开始吗?
going out on a limb...don''t use start?


这篇关于我可以在bat文件中运行两个单独的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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