← Back to list

[SOLVED] How to change HOME directory and start directory on MSYS2?

Ted James · 2025-04-19 16:26 · 0 claps · 0.6 min read
#windows #gcc #mingw-w64 #msys2
Open on Medium ↗
Wiki topics: 🎬 · Film & Television

How to change HOME directory and start directory on MSYS2?

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?

Solution

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

Answered By — dr ganjoo

Answer Checked By — Timothy Miller (FixIt Admin)

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0


메타데이터
post_id
b15c19f9a635
slug
solved-how-to-change-home-directory-and-start-directory-on-msys2-b15c19f9a635
url
https://medium.com/@fixitblog/solved-how-to-change-home-directory-and-start-directory-on-msys2-b15c19f9a635
canonical_url
https://medium.com/@fixitblog/solved-how-to-change-home-directory-and-start-directory-on-msys2-b15c19f9a635
author_url
https://medium.com/@fixitblog
status
ok
fetched_at
2026-07-20 06:28:39