Windows equivalent of the Mac OS X “open” command - windows

Liu Chang asked a very similar question to this one here, Linux equivalent of the Mac OS X "open" command.
Is there a windows equivalent for the Mac OS X "open" command. I'm trying to run a profiler that will open it's results, but it's looking for the "open" command. Basically, the command needs to open a file from the command prompt as if it were double-clicked on in explorer.

The closest thing available is start.
If its first argument is double-quoted, that argument is treated as a window title rather than a filename. Thus, to use it robustly, add an empty string as the first argument:
start "" "my filename.foo"
Thank you to #Holger for pointing this out!

I use to write
explorer.exe <file>

Just typing the file name into a console window will open the file in Windows. I tried several formats - .doc opened with OpenOffice, .mp3 opened with Windows Media Player, and .txt opened with Wordpad. This is the same behavior I experience when double clicking on the files.

Try explorer <filename>. For example I wanted to launch a folder named abc placed at desktop, so I used the command
explorer abc

Use start
I am using Windows 10 and:
> start .
Opens the current directory in File Explorer
> start text.txt
Opened text file in Notepad++ (It is set as my default Txt editor)

I am answering this again as the accepted answer is not correct which
is using the start command (which opens up the CMD as a new instance) and also because The Equivalent according
to me is explorer.exe as also mentioned by others but not clarified
as it should have been!
So, If you want to open the current folder like that with the 'open' command. you should use
explorer.exe .
which will open the current folder in explorer or if you just do the
explorer.exe
then you will open the default This PC location (whether it is recents or my computer or anything else)
It just works as in, when you just type in the file name it will just open in the default program just like
somevideo.mp4
and if you want that file/video to open/play with some other program just write down the program name with the full path (if it's not in the PATH system variable) followed by the filename like
"C:\program files\greentree applications\vlc.exe" somevideo.mp4

Only explorer.exe appears to work under cygwin.

If you use cygwin (or git bash), here's a quick script hack. Change the EDITOR to be whatever you want:
#!/bin/sh
# open
EDITOR="exec subl.exe"
BROWSER="/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"
if [ -d "$1" ]; then
exec explorer.exe $(cygpath -w "$1")
elif [ -f "$1" ]; then
path=$(cygpath --windows "$1")
case "$1" in
*.xml) $EDITOR "$1";;
*.txt) $EDITOR "$1";;
*.html) "$BROWSER" "$path";;
file://*) "$BROWSER" "$path";;
http://*) "$BROWSER" "$path";;
https://*) "$BROWSER" "$path";;
esac
else
# TODO non-existent file/dir
echo "non existent file: $1"
exit 1
fi
exit 0

'start' is definitely the closest thing for Windows as #charles-duffy stated. Depending on your project there are also a few tools out there that solve this problem.
Node opn is a pretty great solution to be totally cross platform

Related

How to open the current directory on Bash on Windows?

I know that in MacOS, people use the open . command to open the current directory in a file manager.
Does anybody know the appropriate command to do the same task in Bash on Windows?
On Windows with Git Bash, just type:
start .
it will open the current directory in the file explorer.
You can now call explorer.exe from the bash subsystem. I've set up an alias to use it. I've added the copy to clipboard alias as well for good measure.
Alias:
alias open="explorer.exe"
alias pbcopy="clip.exe"
Example:
cat ~/.ssh/id_rsa.pub | pbcopy
open .
open "D:\\Dir"
The open alias plays well with ., but you'll need to pass it the Windows path if you want to specify a directory.
Right now Microsoft don't recommend to mix Windows explorer with the bash shell. In latest win10 Insider builds you could use from bash something like this
cmd.exe /c start .
If you are using Win10 Anniversary Edition you could try installing a Desktop Environment. Start reading this
https://github.com/microsoft/bashonwindows/issues/637
After that you could open a window with the present folder content with
gnome-open .
I'm using this function:
open()
{
explorer.exe `wslpath -w "$1"`
}
So if you are in /mnt/c/Users/ and would like to open that folder, just type open .
wslpath will resolve only paths from the Windows system, be aware. If you are looking to do something like open ~ it will not work, and you will get:
wslpath: /home/my-user: Result not representable
Command usage
wslpath usage:
-a force result to absolute path format
-u translate from a Windows path to a WSL path (default)
-w translate from a WSL path to a Windows path
-m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\\’
EX: wslpath ‘c:\users’
A proof that this works:
You Can Use the following command: explorer .
I have added
alias open='explorer.exe `wslpath -w "$1"`'
to the .bashrc file
opens current folder when typed open
I'm using windows ubuntu subsystem.
This command should do it:
$ explorer
try this
$ explorer .
This will work on bash command in windows. I was using R studio and was able to open the directory.
If start . doesn't work for you, it's essentially the same as running explorer.exe . so you can create an alias for it which is what I did.
alias start="explorer.exe"
Side note: Another useful one to have is BROWSER. explorer.exe is capable of starting your default web browser. This comes in handy when you run scripts that open a web browser like starting a React.js development server.
export BROWSER="explorer.exe"
start . - this is the equivalent of open . in bash
To work in all type of paths (Windows-Style and Linux-Style), do as following (the answer of mine to my own question on SU):
(Here my challenge was how I could open Explorer in current working directory with Linux-Style path for view purposes, if you are going into modification or do something else other than just viewing, this is at your own risk, please also read Do not change Linux files using Windows apps and tools):
explorer.exe "C:\Users\userNmae\AppData\Local\Lxss$(sed 's:/:\\:g' <<<"$PWD")"
this will open the Explorer exactly in your working directory. The only thing you need is now define a function to get it to work. You can add this into your .bashrc and source it or re-open Bash.
xplor(){
explorer.exe "C:\Users\userName\AppData\Local\Lxss$(sed 's:/:\\:g' <<<"$PWD")";
}
Note: Replace userName with your Windows User account name there.
In WSL2 it looks like the open command is now doing what start does in Windows command. I just put an alias in my .bashrc
start="open"
Now you can do either start . or open . depending on your preferences.
Using the MINGW64 shell that comes with Git for Windows, I created these functions in my .profile:
function towinpath {
{ cd "$1" && pwd -W; } | sed 's|/|\\|g'
}
function open {
path_to_open=""
if [ -f "$1" ]; then
filename=$(basename "$1")
win_dirname=$(towinpath "$(dirname "$1")")
path_to_open="$win_dirname\\$filename"
elif [ -d "$1" ]; then
path_to_open=$(towinpath "$1")
else
# Take our chances with windows explorer ...
path_to_open="$1"
fi
if [ -z "$path_to_open" ]; then
echo "Failed to open $1"
else
explorer "$path_to_open"
fi
}
This seems to work with just about everything you can throw at Windows File Explorer:
open . # Opens the current directory
open ../ # Opens the directory above this one
open /c/Windows # Opens C:\Windows
open ~/AppData # Opens my AppData folder
open ~/*.csv # Opens the first CSV file in my home directory in Excel
open https://stackoverflow.com # Opens StackOverflow in my browser!
# Opens paths with spaces in them too:
open /c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe
open '/c/Program Files/Sublime Text 3/sublime_text.exe'
To open the current directory via windows subsystem for linux (WSL) use :
$ explorer.exe .
The easiest way is to edit .bash_aliases
nano ~/.bash_aliases
# add
alias open='explorer.exe $1'
# save and close: cltr-s, cltr-x
source ~/.bash_aliases
Now, we can use: open . or open documents
Opening Windows Terminal in a directory and typing start bash will open a bash terminal in that directory.

Associate a file type with emacs/cygwin

I want to use Emacs as and editor and shell.
On Windows 7 I installed cygwin , X11 and emacs.
In terminal I added to /etc/profile file these lines:
XWin -multiwindow 2> /dev/null&
export DISPLAY=:0.0
sleep 1
emacs 2> /dev/null&
I created a shortcut that execute this command: C:\rhcygwin64\bin\mintty.exe -
Now every time I start that shortcut it starts emacs. No problem.
My goal is: associate some file types like .txt , .csv and etc with emacs in order when I start foo.txt it'll open in emacs.
When I tried to do it 'Set Associtation' control it accepts only file name and it does not take '-'. Hence when I try to open foo.txt it does not work. I tried to create a shortcut to mintty.exe but it didn't work either.
Could someone help me to create association in order to start to mintty.exe but rather mintty.exe - ?
Thanks in advance
I am taking my question off .
I realized that my problem is related to subshell issue ... when I try to invoke first cygwin, then emacs under it and etc.
I decided that I will not use much Windows Explorer but rather go directly to the file and open it. This way I don't need file association.
Please close my ticket.
Thanks

How to open webstorm from terminal

To edit files from terminal I use subl (for sublime text) in order to edit the file;
example: If i need to edit app.js file I use subl app.js
Is there any way I can set up webstorm to open from the terminal ?
Try in terminal 'wstorm' and 'webstorm'
If the commands don't work you can run in WebStorm: "Tools" -> "Create Command Line Launcher..."
Note: The solution works only for Linux / MacOS
Update January 2016 using Webstorm 11.0.3 on mac os x
There was no option as described in the accepted answer.
Instead, just use the already installed command line binary wstorm designed for this purpose. Location shown below:
If you actually wish to open webstorm and have it load the contents of the current working directory for example, then place a . after the command:
wstorm .
Noted, others had made similar comments in this answers section, and wished to clarify the situation.
In Webstorm 2020.1.2 you need to do it via JetBrains ToolBox Settings. To do that go to JetBrain Toolbox, click on the settings cog, open Shell Scripts and type the path: /usr/local/bin click apply. Go to your terminal, from your project folder type webstorm . Hope this helps.
As suggested by Ali Faris(comment below), if you have an error like this Shell Scripts failed: /usr/local/bin/webstorm (Permission denied): inside of the logs
Jetbrains Toobox -> settings -> show log files -> toolbox.log (for me in: ~/Library/Logs/JetBrains/Toolbox).
Change /usr/local/bin to another folder name of your choice with the correct access rights, e.g - I chose this name: ~/.jetbrains-launchers.
You can check if script is created by Jetbrains: ls ~/.jetbrains-launchers (you should see a script for each of the jetbrains applications you use).
Add this to your path if needed for example if you use zsh add this at the bottom of your .zshrc export PATH="$HOME/.jetbrains-launchers:$PATH"
Open a new terminal window and this should work.
Basically jetbrains will create script like this (in this case for webstorm cat ~/.jetbrains-launchers/webstorm):
#!/bin/bash
#Generated by JetBrains Toolbox 1.22.10970 at 2022-01-08T12:57:24.803251
declare -a ideargs=()
declare -- wait=""
for o in "$#"; do
if [[ "$o" = "--wait" || "$o" = "-w" ]]; then
wait="-W"
o="--wait"
fi
if [[ "$o" =~ " " ]]; then
ideargs+=("\"$o\"")
else
ideargs+=("$o")
fi
done
open -na "/Users/[YOUR-USER]/Library/Application Support/JetBrains/Toolbox/apps/WebStorm/ch-0/213.6461.79/WebStorm.app/Contents/MacOS/webstorm" $wait --args "${ideargs[#]}"
I also downloaded WebStorm and wanted to use a similar shortcut to open files directly from the terminal.
I was surprised to find I already had a shortcut in my command line tools for webstorm:
subl is to Sublime as wstorm is to Webstorm.
Otherwise, as anstarovoyt has kindly pointed out, you can simply create your own shortcut via "Tools" > "Create Command Line Launcher"
Another way to do that:
open -a /Applications/WebStorm.app #Open last project
open -a /Applications/WebStorm.app Desktop #Open particular folder
open -a /Applications/WebStorm.app Desktop myscript.js #Open particular file
You can add alias to your config file:
#Edit your config:
vim ~/.bashrc
#add line:
alias ws='open -a /Applications/WebStorm.app'
#Read your config file:
source ~/.bashrc
Now you can use it:
ws . myscript.js
I know this is an older thread, but trying to achieve this using Windows was kind of a pain and I wasn't able to find anything specifically designed for my purposes. I created a Bash function that you can add as an alias (for Git Bash on Windows) that works similar to the command line functions in Visual Studio Code.
Here's the link to the Gist.
If you change the integrated terminal in WebStorm to Git Bash (instructions included in the Gist), you can perform the following actions:
Create a new file in the current working directory and open it in the editor:
wstorm foo.js
Create a new file in an existing relative path and open it in the editor:
wstorm foo/bar.js
This also works with subdirectories that don't exist:
wstorm this/path/doesnt/exist/file.js
If you're working in a Git Bash terminal (not in WebStorm) and want to open WebStorm up in the current directory, you can open it similar to Visual Studio Code:
wstorm .
Note: This needs to be done in a directory with a .idea folder.
As of 2019-03-09, WebStorm 2018.3.4 on Mac does not have Tools > "Create Command Line Launcher...". However, this works:
WebStorm Preferences > Keymap > Main Menu > Tools > Create Command-line Launcher...
Right-click "Create Command-line Launcher..." > Add Keyboard Shortcut
Assign a keyboard shortcut
Close Preferences
Type the keyboard shortcut to open "Create Launcher Script"
Click Ok to run the script
You can now launch WebStorm from the terminal with webstorm and can choose a directory to open
After setting up WebStorm to create the cli launcher you actually want to run
wstorm . &
to run the IntelliJ on the background otherwise IntelliJ closes if you happen to close the terminal you have launched the app from.
In WebStorm IDE, click DOUBLE CLICK ON SHIFT and type Create Command Line Launcher then click OK from luncher script promote .
cd project_folder_path using terminal and type webstorm ./ .
that is not for Windows OS
In Ubuntu terminal type:
/var/opt/webstorm6/WebStorm-129.664/bin/webstorm.sh
Note: please see your WebStorm build version, code mine is 129.664
In the terminal, while being in the given project folder:
webstorm .
I know that this is a pretty old thread, but I recently came across this problem on Windows (I'm using the JetBrains Toolbox).
With the following steps all new and existing applications that have been installed with the Toolbox will be added to your path!
Follow these steps to achieve this:
Because of permissions, we need to create a new directory in your user. I named it .path, so that I can also store any other application there in the future. So this will be C:\Users\<PC_USER>\.path\.
The the Toolbox click on the gear icon in the top right corner.
Then click on Enable Shell Scripts and/or Generate Shell Scripts.
In the input field that is located under the switch paste your path folder. (C:\Users\<PC_USER>\.path\)
Open your Edit the system environment variables program that can be found in Windows search or the control panel.
Click on the Environment Variables... button that is located in the right corner, a new window should pop up.
In the new window select the variable that says Path in the Variable column from the top list and then click on the edit button that is situated under the top list. Another new window should pop-up.
Click on new and paste your path there. (C:\Users\<PC_USER>\.path\)
Click on Ok in Edit environment variable > Environment Variables > System Properties.
Go to C:\Users\<PC_USER>\.path\ and all your toolbox installed applications should be there.
Restart your CLI and it should work.
The wstorm command didn't work in my Git bash, so I added the following function to my .bash_profile instead:
wstorm() {
/c/Program\ Files\ \(x86\)/JetBrains/WebStorm\ 2016.2.2/bin/WebStorm.exe $PWD/$1
}
A short solution relevant to the year 2021 for Linux users.
Just execute the comand:
sudo ln -s /<your path to Webstorm directory>/bin/webstorm.sh /usr/local/bin/webstorm
Since /usr/local/bin should be in the PATH environment variable by default, you should be able to run the webstorm command from anywhere in the shell.
More details Webstorm docs
I am running Windows 10 and whipped up a batch file (ws.bat) that implements this with optional command line argument for path to load).
:: place this batch file in your path and set to your WS EXE
:: ref: https://www.robvanderwoude.com/battech_defined.php
:: author: bob#bobchesley.net
#echo off
set target=%1
if defined target (goto passedarg) else (goto noarg)
:passedarg
echo Starting WebStorm with '%target%'
"C:\Program Files\JetBrains\WebStorm 2018.3.2\bin\webstorm.exe" %target%
goto:EOF
:noarg
echo Starting WebStorm with 'Current Dir'
"C:\Program Files\JetBrains\WebStorm 2018.3.2\bin\webstorm.exe" .
Pretty simple but it works.
webstorm . doesn't work on Windows. Try this for the current folder:
webstorm $pwd
$pwd is the current folder's path

Open plain text files with LightTable by default when double-clicking them (in ubuntu 14.04 64bits)

I put LightTable in /opt/LightTable
By default, when you install the text editor LightTable in ubuntu 14.04 64 bits, you don't have an "open with LightTable" when you right-click the file you want to open with it.
Therefore I created a file /home/theuser/.local/share/applications/LightTable.desktop containing :
[Desktop Entry]
Name=LighTable Text Editor
Comment=Edit text files
Exec=/opt/LightTable/LightTable %f
Terminal=false
Type=Application
Icon=/opt/LightTable/core/img/lticon.png
Categories=Utility;TextEditor;
StartupNotify=true
MimeType=text/plain
so that a "open with LightTable" appears when I want open a file with LighTable. Now, the problems begin. When I do this, it only opens LightTable, as if I only ran the script
/opt/LightTable/LightTable
Therefore I went to see the script :
#!/bin/bash
BIN=ltbin
HERE=`dirname $(readlink -f $0)`
LIBUDEV_0=libudev.so.0
LIBUDEV_1=libudev.so.1
add_udev_symlinks() {
# 64-bit specific; look for libudev.so.0, and if that can't be
# found link it to libudev.so.1
FOLDERS="/lib64 /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib"
for folder in $FOLDERS; do
if [ -f "${folder}/${LIBUDEV_0}" ]; then
return 0
fi
done
for folder in $FOLDERS; do
if [ -f "${folder}/${LIBUDEV_1}" ]; then
ln -snf "${folder}/${LIBUDEV_1}" "${HERE}/${LIBUDEV_0}"
return 0
fi
done
echo "${LIBUDEV_0} or ${LIBUDEV_1} not found in any of ${FOLDERS}".
exit 1
}
add_udev_symlinks
ARGS="$#"
CORRECTED=${ARGS//-/<d>}
CORRECTED=${CORRECTED// /<s>}
if [ -t 0 ] && [ $# != 0 ]; then
#We're in a terminal...
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN "<d><d>dir=`pwd`<s>$CORRECTED" &
else
#We were double clicked
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN &
fi
and replaced its ending if/else/fi by a simple :
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN "<d><d>dir=`pwd`<s>$CORRECTED" &
so that the right behaviour (the one when opening a file from the terminal) is chosen.
This almost made my day. Now, if I double-click a file or right-click it and select "open with LightTable", the file is indeed opened in LightTable... but : this is true only if the file name and the path to the file have no blank space in their names.
If the file named "the file" is in the path thepath without space in it, when I double-click it, it opens two blank files "the" and "file" in LightTable. The same behavior is constated if thepath has space(s) in it.
Would someone have an idea ? I guess I should correct the bash script, but I'm not an expert in it. (I am not even sure that the script is really wrong...)
Thanks in advance
MEF
Your question has a tl;dr quality about it.
When you store "$#" in a variable, you really have to use an array and lots of quotes to preserve the elements with whitespace:
ARGS=("$#")
CORRECTED=("${ARGS[#]//-/<d>}")
CORRECTED=("${CORRECTED[#]// /<s>}")
But then the way you have to pass the args is a problem:
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN "<d><d>dir=`pwd`<s>$CORRECTED" &
It's impossible to expand the array into a single space-delimited string and then somehow extract the elements that have significant whitespace.
You may have to do this, and see if it works:
export LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" # might as well put on own line
"$HERE/$BIN" "<d><d>dir=`pwd`<s>" "${CORRECTED[#]}" &
# ...........^^^^^^^^^^^^^^^^^^^^ standalone argument
Actually, this is a bug in LightTable.
I opened an issue (https://github.com/LightTable/LightTable/issues/1762) and submitted a patch (https://github.com/LightTable/LightTable/pull/1763) to fix this :
There are 2 issues here:
currently the deployed Bash script doesn't pass any arguments to LightTable if it's not invoked from a terminal, but this is needed e.g. to make a gnome desktop shortcut. This issue can also be reproduced by using the ALT+F2 launcher under Ubuntu.
independently LightTable cannot currently open files whose names contain ' ' characters.

How do I launch a Git Bash window with particular working directory using a script?

How can I launch a new Git Bash window with a specified working directory using a script (either Bash or Windows batch)?
My goal is to launch multiple Git Bash windows from a single script, each set to a different working directory. This way I can quickly get to work after booting the computer instead of having to open Git Bash windows and navigating each one to the correct working directory.
I am not asking how to change the default working directory, like this question does, but to launch one or more terminal windows with different working directories from a script.
Another option is to create a shortcut with the following properties:
Target should be:
"%SYSTEMDRIVE%\Program Files (x86)\Git\bin\sh.exe" --login
Start in is the folder you wish your Git Bash prompt to launch into.
Try the --cd= option. Assuming your GIT Bash resides in C:\Program Files\Git it would be:
"C:\Program Files\Git\git-bash.exe" --cd="e:\SomeFolder"
If used inside registry key, folder parameter can be provided with %1:
"C:\Program Files\Git\git-bash.exe" --cd="%1"
Git Bash uses cmd.exe for its terminal plus extentions from MSYS/MinGW which are provided by sh.exe, a sort of cmd.exe wrapper. In Windows you launch a new terminal using the start command.
Thus a shell script which launches a new Git Bash terminal with a specific working directory is:
(cd C:/path/to/dir1 && start sh --login) &
(cd D:/path/to/dir2 && start sh --login) &
An equivalent Windows batch script is:
C:
cd \path\to\dir1
start "" "%SYSTEMDRIVE%\Program Files (x86)\Git\bin\sh.exe" --login
D:
cd \path\to\dir2
start "" "%SYSTEMDRIVE%\Program Files (x86)\Git\bin\sh.exe" --login
To get the same font and window size as the Git Bash launched from the start menu, it is easiest to copy the start menu shortcut settings to the command console defaults (to change defaults, open cmd.exe, left-click the upper left icon, and select Defaults).
Let yet add up to the answer from #Drew Noakes:
Target:
"C:\Program Files\Git\git-bash.exe" --cd=C:\GitRepo
The cd param should be one of the options how to specify the working directory.
Also notice, that I have not any --login param there: Instead, I use another extra app, dedicated just for SSH keys: Pageant (PuTTY authentication agent).
Start in:
C:\GitRepo
The same possible way, as #Drew Noakes mentioned/shown here sooner, I use it too.
Shortcut key:
Ctrl + Alt + B
Such shortcuts are another less known feature in Windows. But there is a restriction: To let the shortcut take effect, it must be placed somewhere on the User's subdirectory: The Desktop is fine.
If you do not want it visible, yet still activatable, place this .lnk file i.e. to the quick launch folder, as that dir is purposed for such shortcuts. (no matter whether displayed on the desktop) #76080 #3619355
"\Application Data\Microsoft\Internet Explorer\Quick Launch\"
In addition, Win10 gives you an option to open git bash from your working directory by right-clicking on your folder and selecting GitBash here.
Windows 10
This is basically #lengxuehx's answer, but updated for Win 10, and it assumes your bash installation is from Git Bash for Windows from git's official downloads.
cmd /c (start /b "%cd%" "C:\Program Files\GitW\git-bash.exe") && exit
I ended up using this after I lost my context-menu items for Git Bash as my command to run from the registry settings. In case you're curious about that, I did this:
Create a new key called Bash in the shell key at HKEY_CLASSES_ROOT\Directory\Background\shell
Add a string value to Icon (not a new key!) that is the full path to your git-bash.exe, including the git-bash.exe part. You might need to wrap this in quotes.
Edit the default value of Bash to the text you want to use in the context menu
Add a sub-key to Bash called command
Modify command's default value to cmd /c (start /b "%cd%" "C:\Program Files\GitW\git-bash.exe") && exit
Then you should be able to close the registry and start using Git Bash from anywhere that's a real directory. For example, This PC is not a real directory.
This is the command which can be executed directly in Run dialog box (shortcut is win+R) and also works well saved as a .bat script:
cmd /c (start /d "/path/to/dir" bash --login) && exit
I'm not familiar with Git Bash but assuming that it is a git shell (such as git-sh) residing in /path/to/my/gitshell and your favorite terminal program is called `myterm' you can script the following:
(cd dir1; myterm -e /path/to/my/gitshell) &
(cd dir2; myterm -e /path/to/my/gitshell) &
...
Note that the parameter -e for execution may be named differently with your favorite terminal program.
Using Windows Explorer, navigate to any directory you want, type "cmd" in the address bar it will open Windows command prompt in that directory.
Along the same lines, if you have the git directory in your path, you can type "git-bash" in the address bar and a Git Shell will open in that directory.
If using Windows OS :
Right click on git terminal > Properties
Properties>Under shortcut tab>Start in:
add your folder target path like below image

Resources