如何在MSYS2上更改HOME目录并启动目录? [英] How to change HOME directory and start directory on MSYS2?
问题描述
我已经安装了MinGW-w64和MSYS2.但是,如何更改MSYS2中的HOME目录?这样,当我键入cd $ home或cd〜时,它将转到我定义的另一个目录.
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.
如何编写代码,以便起始目录始终位于.bat文件所在的位置?
And how do I write a code so that the starting directory is always where the .bat file is placed on?
在cmd中,我使用了以下代码:
In cmd I used this code:
%〜d1 cd%〜p1" 呼叫cmd
%~d1 cd "%~p1" call cmd
因此,当我在桌面上打开cmd时,它将从桌面上的目录开始.
so when I open cmd on my desktop, it starts from the directory on desktop.
我如何使用msys2做类似的事情?
How can I do a similar thing with msys2?
推荐答案
如果要将Windows主文件夹用作MSYS2的主文件夹,则可以编辑/etc/nsswitch.conf并编写:
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
这篇关于如何在MSYS2上更改HOME目录并启动目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!