Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change HOME directory and start directory on MSYS2?

Tags:

I have installed MinGW-w64 and MSYS2. But how do I change the HOME directory in MSYS2? So that when I type cd $home or cd ~ it goes to another directory that I defined.

And how do I write a code so that the starting directory is always where the .bat file is placed on?

In cmd I used this code:

%~d1 cd "%~p1" call cmd

so when I open cmd on my desktop, it starts from the directory on desktop.

How can I do a similar thing with msys2?

like image 331
Coder88 Avatar asked Nov 26 '15 16:11

Coder88


People also ask

How do I change my PATH in Msys?

How do I change the PATH in MS-Windows? In MS-Windows XP you can make global changes (either for one user or the system) to the PATH using the "Control Panel" by clicking on the System icon, selecting the Advanced tab, clicking on Environment Variables, selecting PATH (in the appropriate category) and clicking on Edit.

Where is Msys home directory?

MinGW/MSYS usually creates a home folder under C:/MinGW/msys/1.0/home/user if you installed them as usual (accepting the defaults) and you executed msys.


2 Answers

If you would like to use your windows home folder as the home folder for MSYS2, you can edit /etc/nsswitch.conf and write:

db_home: windows 
like image 181
dr ganjoo Avatar answered Oct 13 '22 00:10

dr ganjoo


Msys2 will use windows %HOME% as it's $HOME dir. If you set %HOME% in environment variables (to the windows directory you need Msys2 to use) it will work.

like image 38
Adna Kateg Avatar answered Oct 13 '22 00:10

Adna Kateg