42

I'm using InteliJ IDEA (Community addition) and I found myself doing some file transfers to and from the project folder. After reapeating the task for a while I've created some batch scripts that transfering the files automaticly. Now, I'll be much more happy if I could run the scripts directly from the IDE - by pressing a button for example...

Question is: Can I add buttons to IntelliJ IDE - that will run a batch file? If it's possible I'll be happy to know how it can be done.

Thanks!

yossico
  • 3,421
  • 5
  • 41
  • 76
  • You can add buttons linked to your external tool. Create a new question that can be answered without changing the current. – maba Sep 22 '14 at 16:38
  • 1
    @maba - I added question - it's in http://stackoverflow.com/q/25993042/1726419 – yossico Sep 23 '14 at 10:43

4 Answers4

53

You can use "External Tools" to invoke any program

Goto Settings->External Tools and create a tool which will open the following dialog choose the batch file for Program.

Create Tool Dialog

Then the tool will be available in the menu Tools

Tools Menu

Ref:External Tools

Update:

If you want to link an 'External Tool' to a 'Button' in the toolbar check How to add buttons linked to your external tool in InteliJ IDEA

Community
  • 1
  • 1
seenukarthi
  • 8,241
  • 10
  • 47
  • 68
22

Also if you install "Batch Scripts Support" plugin, you will get nice file context menu actions for running batch files directly from the project view.

NOTE 2019: The original authors abandoned the plugin, but there is a maintained fork for current versions of IntelliJ: https://github.com/SimonIT/idea-batch

NOTE 2020: Even newer fork is: https://github.com/aefimov/idea-batch

Context menu

Igor Mukhin
  • 15,014
  • 18
  • 52
  • 61
  • Your link gives 404, I think this is the new github repo https://github.com/aefimov/idea-batch – Dwhitz Jan 24 '20 at 09:55
9

Another alternative to IntelliJ 2019 is:

Edit Configuration > Click '+' > Select Shell Script > 'In Script path:' set the .bat file location > OK > Click play button or Run once you have saved it

See image below: enter image description here

pvma
  • 403
  • 8
  • 14
1

Install "Batch Scripts Support" plugin. Then choose + -> Batch:

enter image description here

Mir-Ismaili
  • 13,974
  • 8
  • 82
  • 100