I have a script that needs be launch through Cygwin with the following execution
/usr/bin/bash -lic "/home/userdude/scripts/scrypty.sh param1 param2"
How would I go about setting up a keyboard shortcut in windows to pass the above through Cygwin?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Example self answer submission:
To execute this from a shortcut we first need to work out how to call it from the command line then build a shortcut based off the command line arguments and assign a keyboard shortcut to it.
Identifying command line arguments to use
1st Step, Identifying what we will be using to call everything so we start with:
2nd Step, We need to look up the man pages to find what arguments we can run; for this we will choose
-e this will call
mintty.exe to execute something in this case we want to execute
C:\cygwin\bin\mintty.exe -e /usr/bin/bash
3rd Step, from here we are working of
bash command line arguments so we look up the man pages for @user447607's case he wants to start up an interactive
-l shell to execute
-c so we now will have a full command to use:
C:\cygwin\bin\mintty.exe -e /usr/bin/bash -lic "/path/to/my/script.sh myScriptParm1 myScriptParm2"
Option 1 - Using AutoHotKey
Open up your
AutoHotkey.ahk and add this line:
^!1::Run, C:\cygwin\bin\mintty.exe -e /usr/bin/bash -lic "/path/to/my/script.sh myScriptParm1 myScriptParm2"
This will run the file when the ^!1 key combo is pressed ctrl+alt+1
Save the file and done
Option 2 - Using windows shortcuts
Right-click your desktop >
2nd Step, building the shortcut through the windows wizard Note this is the process for windows 7 your windows version might differ
We just want to paste our command from above
Give it a relevant name
Right-click the new shortcut >
Shortcut Key: field and press the keystrokes you would like to call it from
Personal opinion If a problem was hard enough to solve that you would like to submit it as a self answer so that other people can benefit from the work you have already put in to solve it, please put in the effort to show how it was solved, give details, explain it slowly above all else make sure whoever reads it has enough information to adapt it to their own needs.