1
Start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login 
cd E:
git clone SshLink

The above command is first opening normal cmd and then E: drive and then gitbash shell. I just want to open git-shell directly and change the directory to E: drive and give clone command.

Compo
  • 36,585
  • 5
  • 27
  • 39
Pratik Kumar
  • 69
  • 1
  • 6

1 Answers1

1

You could try:

Start "" "%PROGRAMFILES%\Git\bin\bash.exe" -c "cd /e; git clone SshLink; bash"

That will open a bash, go to the drive E and try the git clone
The final bash allows for the session to not close immediately.


Other option, as mentioned in the comments by Compo:

Start /d E:\ "%ProgramFiles%\Git\bin\bash.exe" -c "git clone SshLink; bash"

That would use the /d option of start.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    It would make more sense, to use the available `start` options, i.e. `/D`. For example, `Start /D E:\ "%ProgramFiles%\Git\bin\bash.exe" -C "git …`. _The `/D` option allows to preset the working directory._ – Compo Apr 19 '20 at 17:05
  • @Compo Thank you, good point. I have edited the answer accordingly to include your comment. – VonC Apr 19 '20 at 17:16