How to bind shell script to context menu in windows?


A couple of days ago I wrote my first simplest script .sh that does 4 simple operations with image files. Resize, watermark, rename and send it all via ftp. The script works with a bang. But I want the context menu to have pkm -> send -> script. And by pressing, the script starts and does everything, because manually constantly driving in the path of the script is boring. I've already implemented this with bash from git (which comes with my git install). It was simple there, I just inserted

--cd="%v." "d:/Work/scripts/sh/"

into the file arguments C: \ Program Files (x86) \ Git \ git-bash.exe and everything works. But I need Cygwin, because it supports BC to calculate decimal places. To call cygwin and execute the script, I wrote like this

C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe "%V" "d:/Work/scripts/sh/" 

But instead of executing the script, the window just opens with the current directory and more and more no reaction. I googled for a very long time, but I could not find answers on the Russian forums, but on the English-speaking ones they wrote that it was necessary to add sh.exe before the address to the script. But there’s no point. I suspect that the path is too long so it won't open. But I tried to insert

C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe "%V" "d:/Work/scripts/sh/"

c Run (win + R) but still no response. How to do it? PS I don't know the correct forum section I wrote.


This is how I start / stop lighttpd with Perl. Maybe it will help.

C:\x\cygwin\bin\mintty.exe -h start /bin/bash -l -c "/cygdrive/c/do/scripts/"

Tweak the last parameter.

Scroll to Top