如何从eclipse运行批处理脚本(.bat文件)

时间:2022-10-26 02:32:30

My Java application is started by running a set of commands that are present in a batch file (.bat file). And I imported this into Eclipse workbench. How do I execute the batch file from Eclipse. Similar to the one in command line, I directly give "path:\myBatchfile.bat". Is there any way I can do directly from Eclipse.

我的Java应用程序是通过运行批处理文件(.bat文件)中存在的一组命令来启动的。我将其导入Eclipse工作台。如何从Eclipse执行批处理文件。与命令行中的类似,我直接给出“path:\ myBatchfile.bat”。有什么方法可以直接从Eclipse做。

4 个解决方案

#1


You can call your .bat file using the External Tools feature (in the Run menu).

您可以使用“外部工具”功能(在“运行”菜单中)调用.bat文件。


Example:

如何从eclipse运行批处理脚本(.bat文件)

如何从eclipse运行批处理脚本(.bat文件)

如何从eclipse运行批处理脚本(.bat文件)

#2


Or, you could create an Ant build file, which can call external applications.

或者,您可以创建一个Ant构建文件,该文件可以调用外部应用程序。

This will give you the advantage to call the .bat not only from Eclipse, but other IDE's, or from command line (on any machine).

这将使您不仅可以从Eclipse,而且可以从其他IDE或命令行(在任何计算机上)调用.bat。

http://ant.apache.org/manual/Tasks/exec.html

#3


You can also run a batch file (or any other executable file) by opening it with the System Editor. Use Open With -> System Editor.

您还可以通过使用系统编辑器打开批处理文件(或任何其他可执行文件)来运行它。使用打开方式 - >系统编辑器。

#4


Associate with text Editor by right-click - Open With (As of 2017 there is no plugin with special editor )

通过右键单击与文本编辑器关联 - 打开方式(截至2017年,没有带特殊编辑器的插件)

To run install plugin like https://marketplace.eclipse.org/content/easyshell
You can easy run .sh with Git Bash as well

要运行像https://marketplace.eclipse.org/content/easyshell这样的安装插件你也可以使用Git Bash轻松运行.sh

如何从eclipse运行批处理脚本(.bat文件)

or https://github.com/culmat/eExplorer

#1


You can call your .bat file using the External Tools feature (in the Run menu).

您可以使用“外部工具”功能(在“运行”菜单中)调用.bat文件。


Example:

如何从eclipse运行批处理脚本(.bat文件)

如何从eclipse运行批处理脚本(.bat文件)

如何从eclipse运行批处理脚本(.bat文件)

#2


Or, you could create an Ant build file, which can call external applications.

或者,您可以创建一个Ant构建文件,该文件可以调用外部应用程序。

This will give you the advantage to call the .bat not only from Eclipse, but other IDE's, or from command line (on any machine).

这将使您不仅可以从Eclipse,而且可以从其他IDE或命令行(在任何计算机上)调用.bat。

http://ant.apache.org/manual/Tasks/exec.html

#3


You can also run a batch file (or any other executable file) by opening it with the System Editor. Use Open With -> System Editor.

您还可以通过使用系统编辑器打开批处理文件(或任何其他可执行文件)来运行它。使用打开方式 - >系统编辑器。

#4


Associate with text Editor by right-click - Open With (As of 2017 there is no plugin with special editor )

通过右键单击与文本编辑器关联 - 打开方式(截至2017年,没有带特殊编辑器的插件)

To run install plugin like https://marketplace.eclipse.org/content/easyshell
You can easy run .sh with Git Bash as well

要运行像https://marketplace.eclipse.org/content/easyshell这样的安装插件你也可以使用Git Bash轻松运行.sh

如何从eclipse运行批处理脚本(.bat文件)

or https://github.com/culmat/eExplorer