# Windows 上使用 bash

以下教大家兩種方式，如何在 Windows 使用 bash

## Git Bash

這個方法為，安裝 Git 後，在桌面或檔案夾按右鍵選擇 Git Bash Here 即可

![](/files/-MBo01HTFWpk4NKnJVPB)

你可以同時使用 bash 和 windows 的指令。

{% embed url="<https://git-scm.com/>" %}
到 git 官網下載
{% endembed %}

## Windows Subsystem for Linux

這是在 Windows 上運行 Linux 的方法，不用再安裝虛擬機了。

選擇程式集

![](/files/-MBo2LwoLCv48zSZcYan)

選擇開啟或關閉 Windows 功能

![](/files/-MBo2_xFcKLv0--A6cIR)

打勾適用於 Linux 的 Windows 子系統

![](/files/-MBo2qN5tE4CK4QupOj5)

接著重新啟動系統

到 Windows 商店安裝 Ubuntu，啟動應用程式即可

![](/files/-MBo3LVz4eysv1KPb0un)

你也可以在命令提示字元輸入 ubnutu 進入子系統

這個子系統的路徑大概位置如下

C:\Users\UserName\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows...\LocalState\rootfs


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kanneg881.gitbook.io/workspace/zhong-duan/bash-jiao-ben/windows-shang-shi-yong-bash.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
