Search code examples
windowsgitregistryshortcutgit-bash

Shortcut's "Start In" analog using registry


I want to have an ability to run some application (Git bash) on my Windows 10 by passing some command to a Win + R "Run" window.

So I defined a key in my registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gbash.exe,

than changed Default property to path to the git-bash.exe application and specify Path property to the git-bash.exe parent folder.

Now I have an ability to run GitBash throw Win + R using gbash command.

But when I run it using a shortcut, I can specify a Start In property, so git will be opened in this specified directory without necessity of doing dozen of cd's, and when I run GitBash using created gbash command, it starts in the default directory.

So how can I change start in folder for my gbash command?


Solution

  • Solved this by creating .bashrc file in my user directory and adding to this file next row:

    cd C:/path/to/needed/directory;