2

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?

4
  • I already know the answer for this. I just wanted to store it where it might help others. First create a desktop shortcut then set the target to something like: C:\cygwin\bin\mintty.exe -w hide -e /usr/bin/bash -lic "/home/userdude/scripts/scrypty.sh param1 param2" Then set a keyboard shortcut for the icon.
    – user447607
    Commented Sep 19, 2013 at 21:42
  • 2
    You can answer your own question. In it's current state though it's very low quality take the time to break down what each segment does and take a screen shot of the shortcut property to attach and add it.
    – 50-3
    Commented Sep 19, 2013 at 21:51
  • @50-3 seems clear to me. doesn't really need a picture for how to create a shortcut. think about it 50-3!!! somebody looking about making a shortcut to a cygwin script doesn't need a pic. just being told there is a tab in shortvut properties to add a keyboard. That said. snippy and pasting to imgur can make a pic quickly. (that said, i can't even make a shortcut to open notepad - must be a quirk, but I see the process)
    – barlop
    Commented Sep 19, 2013 at 22:12
  • 2
    @barlop the reason I would say low quality is 1its a comment 2 I see a lot of flags, I can guess what they do but more details would be great 3 you and I know How to assign, kkeyboard shortcuts in windows but if someone wasunsure hHow to and found this question your comment would be the only way of knowing the shortcut field is in properties
    – 50-3
    Commented Sep 19, 2013 at 22:22

1 Answer 1

3

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.


Part 1

Identifying command line arguments to use

1st Step, Identifying what we will be using to call everything so we start with:

C:\cygwin\bin\mintty.exe

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 /usr/bin/bash

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 -i login -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"


Part 2

Building the shortcut

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

1st Step, Right-click your desktop > New > Shortcut

Create shortcut

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 Create shortcut 1st screen

Give it a relevant name Naming shortcut

3rd Step, Right-click the new shortcut > Properties > Shortcut tab

Highlight the Shortcut Key: field and press the keystrokes you would like to call it from

Properties - Shortcut tab


Foot notes:

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.

2
  • Agree but what you might expect, happened. I solved it and then there was immediately a greater priority resulting in me not getting back to the topic for weeks. It ain't perfect but it's better than nada.
    – user447607
    Commented Oct 8, 2013 at 21:27
  • Don't worry to much, just in future try and include as much details as you can as someone less skilled might find your post and be lost. Quality content is the key to building this community and if you looked back at this in 5-10 years you might get lost too without extra details :)
    – 50-3
    Commented Oct 8, 2013 at 21:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .