0

How can I create a shortcut, specifically in SendTo (i.e. not on the right-click context menu itself) that opens git-bash.exe in a folder I have right-clicked on. There is this very good answer for the context menu itself, but I don't want to clutter up my context menu with too many things that I don't use too often, so SendTo has become quite useful for me (after I delete all of the junk that Microsoft puts in there like 'Send to Bluetooth Device', and 'Send to Fax Machine' etc that no one ever uses). I've tried variations of .lnk in shell:sendto based on the above context menu answer like C:\Program Files\GitPortable\git-bash.exe --cd=%1 but no luck so far.

This link was suggested and I've painstakingly gone through every option there and none of them work for this. It sounds like this should be something simple with a simple solution (some combination of arguments in the Target field, and the --cd switch is almost certainly involved) but, so far, I have not found the secret sauce to make this work.

YorSubs
  • 3,194
  • 7
  • 37
  • 60
  • 1
    See that answer. You need to set the "start in" attribute of your shortcut. [How do I launch a Git Bash window with particular working directory using a script?](https://stackoverflow.com/questions/19916670/how-do-i-launch-a-git-bash-window-with-particular-working-directory-using-a-scri) – Sage Pourpre Oct 13 '22 at 07:08
  • Try `C:\Program Files\GitPortable\git-bash.exe --cd` as the shortcut target (without `=`). Selected items are appended with a space to the command-line. If this doesn't work, use a batch file to pass `%1` or a PowerShell script to pass `$args[0]` to `git-bash`. – zett42 Oct 13 '22 at 07:41
  • Sadly, `--cd`, with or without the `=` does not make a shortcut that will open git in the right folder. I see your point that selected items get a space appended, that's important. Seems overkill to have to use a script for something as simple as this, but that may indeed be the case. – YorSubs Oct 14 '22 at 05:26

0 Answers0