How to Open current directory in TotalCommander in Windows Terminal? - windows-terminal

I'm using git-bash with Windows Terminal, I want to open current directory in a new Total Commander tab by typing a command like tc.
I tried to add alias tc='D:\\programs\\totalcmd\\TOTALCMD64.EXE \/O \/T \/R="$PWD"' in bash.bashrc`, but it has 2 problems.
It create a new Total Commander instance everytime.
It not open current directory in my git-bash
So How to Open current directory in TotalCommander in Windows Terminal (with git-bash)?

Related

How open the current directory on Git Bash in windows using keyboard shortcut?

In my Windows laptop i want to set a shortcut key such that whenever I click on the shortcut keys from my keyboard it will open the Git Bash in the current directory and the path would also be the current directory in Git Bash.
Example:
Let i have choose a shortcut Ctrl + G. So, i want that whenever i click on Ctrl+G it will open a git bash and the path on Git bash should be the current directory from where i have entered the shortcut keys.
Inplace of opening Git Bash from right-context, i want to do the same from keyboard only by clicking some key combination to open the Git Bash.
Unable to find any solution to this query. In place of it there are solution to setup on right-click context and i want it to do with the help of keyboard.
You can setup an AutoHotkey script as in here to open a CMD in the current path.
Except instead of opening a new CMD, you can run bash --login, assuming C:\Program Files\Git\bin is in your %PATH%.
Run, cmd /K (start /d "C:\your\path" bash --login)

How to open working directory of a file showing on iterm2 by mouse?

There is a file showing on iTerm2 screen as below
test.txt
I want to open working directory of this file using iTerm2. But ⌘-click only opens files but not its working directory on Finder. I do not find any keys or method from iTerm2 to get this.
You can install bash/zsh themes(depending on what shell you use) that show the current directory in the shell prompt. You can then ⌘-click on that.
Bash themes(Bash-it): https://github.com/Bash-it/bash-it/wiki/Themes
Zsh themes(oh-my-zsh):
https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
You can simply exec open .
It will open the finder from the current directory

How can I open command prompt in the current directory as a shortcut

I'm just wondering how I can make a shortcut that will open command prompt in the folder it is currently in.
Why I need this.
I save my c program file in the directory Users\PC\Documents\Other\My_Programs\WIP\Project_1\Test\
So I would have to type cd Users\PC\Documents\Other\My_Programs\WIP\Project_1\Test\ every time I want to open the command prompt in that directory.
Is there a shortcut I can make where I can move that shortcut around anywhere (don't need to change the shortcut) and it will open command prompt in the directory it is current in, so I don't need to keep typing cd .....
you can go to the directory and just type start . in the same directory
or you can make a batch file like test.bat and add below line in the same:
cd Users\PC\Documents\Other\My_Programs\WIP\Project_1\Test\
Save it anywhere and whenever you will run that batchfile, it will automatically move PWD to the required directory
Right-click in the open space of your desktop and click New > Shortcut
For the location, type or copy and paste one of the following lines.
%windir%\system32\cmd.exe /k cd Users\PC\Documents\Other\My_Programs\WIP\Project_1\Test\
As commented by aschipfl, you can already do it, (may be OS dependent)!
In Windows Explorer, or I suppose the desktop, just hold down the shift key, right click in a blank area of it and choose Open command window here, (or whatever your locale states).
I think in Windows 10 at least, the option is even available in the Explorer toolbar menu too.

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?
Solved this by creating .bashrc file in my user directory and adding to this file next row:
cd C:/path/to/needed/directory;

Gitbash versus Command Prompt (Windows)

What is the difference between running commands on Gitbash (on windows) and the command prompt? I installed Gitbash on my Windows machine and using the mkdir function does not create a new directory (a folder that I can see).
git bash opens an msys bash session
git-cmd.bat opens a CMD session
Both set HOME properly (it is not set by default in Windows, as opposed to Unix/Linux).
And both add Git to the %PATH%.
They are package in Git For Windows (with a 64bits coming soon, with a more recent bash).
in gitbash mingw64 for windows 10 when you are in c:, mkdir creates new directory without problems.
For do it, you can go to c: by typing cd /c/ and after, press enter key. When you are in C change to your work directory with CD command, and type mkdir yournewdirectoryname. It works for me.

Resources