Author Topic: Custom Command to Run in Git Bash  (Read 6668 times)

parcher

  • Junior Member
  • **
  • Posts: 13
    • View Profile
Custom Command to Run in Git Bash
« on: November 26, 2016, 17:27:30 »
I want to create a custom command to run the program G'Mic within Git Bash on selected images.

Command:

Code: [Select]
gmic *jpg -gimp_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0,0 -o 0000.jpg
This command takes jpg images, from which a montage of the jpgs is created.

This is what I have:

Code: [Select]
Group: MC
Function: Run
Options/Parameters: ADMIN

Command Type: Custom Commands

Command:

MC.Run CMD="gmic *jpg -gimp_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0,0 -o 0000.jpg"

When I run this command on selected jpgs I see the Windows command shell quickly open and close and not perform the requested action. This is because the command doesn't work in Windows command shell. It needs to run in Git Bash, which I have installed and have confirmed works with this command.

I assume I need to tell MultiCommander to run this command in Git Bash. But how to do it? And will the resulting montage be placed in the folder of the source images?

My Git Bash path:
Code: [Select]
C:\Program Files (x86)\Git\bin\sh.exe

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Custom Command to Run in Git Bash
« Reply #1 on: November 30, 2016, 22:52:51 »
MC will send the everything in the CMD="" and Windows to run it. 
You need execute sh.exe from CMD and the thing you want it to run as a parameter to it. if that is possible. Not sure how sh.exe works

How would you run it from a normal console problem. ?
Maybe easier to create a UserDefinedCommand of Batch that create a .bat script and in that you maybe can launch sh and this things.

However you need to include sh.exe some way..  There is no way of MC to know about sh.exe

parcher

  • Junior Member
  • **
  • Posts: 13
    • View Profile
Re: Custom Command to Run in Git Bash
« Reply #2 on: December 02, 2016, 15:34:01 »
I found a solution:

Code: [Select]
C:\Windows\System32\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i -- C:\Users\Scripts\gmicmont.sh"
Command type: External