Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在windows中更改bash脚本中的目录_Windows_Bash_Path_Cd - Fatal编程技术网

在windows中更改bash脚本中的目录

在windows中更改bash脚本中的目录,windows,bash,path,cd,Windows,Bash,Path,Cd,如何在windows中更改bash脚本中的工作目录。我有 ~dp0=C:\test\docker\windows,我想将我的目录更改为C:\test\build 所以它意味着向上2级,然后INTO构建文件夹 感谢使用bash脚本更改目录,就像使用普通bash一样 cd "C:/test/build" echo "You're now in the folder, do what you will." 将文件另存为.sh,这样就可以使用它。 注意,当使用bash脚本导航文件夹时,请记住您将从的目

如何在windows中更改bash脚本中的工作目录。我有 ~dp0=C:\test\docker\windows,我想将我的目录更改为C:\test\build 所以它意味着向上2级,然后INTO构建文件夹


感谢使用bash脚本更改目录,就像使用普通bash一样

cd "C:/test/build"
echo "You're now in the folder, do what you will."
将文件另存为.sh,这样就可以使用它。 注意,当使用bash脚本导航文件夹时,请记住您将从的目录始终是主目录。

因为默认情况下C:\已装入/mnt/C,所以这将起作用。 通过以下命令在主路径中创建.bashrc:

    echo "BUILDDIR=/mnt/c/test/build" >> ~/.bashrc;source ~/.bashrc
    cd $BUILDDIR         

    # Do your work below for example ./configure.
    ./configure 

在我的Git bash系统上,C:\root只是
/C/
,其他目录都是,所以它应该是
cd/C/test/build/

您还可以说
cd.././build/

祝你好运