AdSense

2026/10/21

Windows 11 安裝Google Cloud CLI

Windows 11安裝Google Cloud CLI的方式如下:


安裝環境:

  • Windows 11 專業版 版本25H2


開啟PowerShell貼上以下。

(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")

& $env:Temp\GoogleCloudSDKInstaller.exe

接著便會出現安裝對話視窗,按[Next]到底即可。



安裝完成。



然後會詢問是否要註冊,輸入"Y"同意。

Welcome to the Google Cloud CLI! Run "gcloud -h" to get the list of available commands.
---
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

You must sign in to continue. Would you like to sign in (selecting "Y" will open your browser to the sign-in page where
you complete authentication) (Y/n)?Y

然後會開啟瀏覽器求使用Google帳號權限。


Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=...

You are signed in as: [yourname@gmail.com].



通過驗證後會詢問選擇使用哪個專案,這邊選擇[5]建立一個新專案。


Pick cloud project to use:
 [1] gen-lang-client-0046812508
 [2] steady-tracer-193910
 [3] tidal-mason-366907
 [4] Enter a project ID
 [5] Create a new project
Please enter numeric choice or text value (must exactly match list item):  5

然後會請你輸入project ID,必須是6-30個字元,小寫的英文、數字和減號(hyphen)的組合。

若出現的紅色ERROR訊息"Compute Engine API has not been used..."的警告/錯誤,是因為新建專案尚未啟用Compute Engine API,不影響 gcloud CLI 的基本安裝與專案建立。後續如有需要,點擊連結前往 Console 啟用即可。

Enter a Project ID. Note that a Project ID CANNOT be changed later.
Project IDs must be 6-30 characters (lowercase ASCII, digits, or
hyphens) in length and start with a lowercase letter. ecospeak-matthung-2026
Waiting for [operations/create_project.global.6202270307295542149] to finish...done.
Your current project has been set to: [ecospeak-matthung-2026].

ERROR: (gcloud.compute.project-info.describe) [yourname@gmail.com] does not have permission to access projects instance [ecospeak-matthung-2026] (or it may not exist): Compute Engine API has not been used in project ecospeak-matthung-2026 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=ecospeak-matthung-2026 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. This command is authenticated as yourname@gmail.com which is the active account specified by the [core/account] property.
Compute Engine API has not been used in project ecospeak-matthung-2026 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=ecospeak-matthung-2026 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Google developers console API activation
https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=ecospeak-matthung-2026
...
Not setting default zone/region (this feature makes it easier to use
[gcloud compute] by setting an appropriate default value for the
--zone and --region flag).
See https://cloud.google.com/compute/docs/gcloud-compute section on how to set
default compute region and zone manually. If you would like [gcloud init] to be
able to do this for you the next time you run it, make sure the
Compute Engine API is enabled for your project on the
https://console.developers.google.com/apis page.

Created a default .boto configuration file at [C:\Users\user\.boto]. See this file and
[https://cloud.google.com/storage/docs/gsutil/commands/config] for more
information about configuring Google Cloud Storage.
The Google Cloud CLI is configured and ready to use!

* Commands that require authentication will use yourname@gmail.com by default
* Commands will reference project `ecospeak-matthung-2026` by default
Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the CLI like arg files and output formatting
* Run `gcloud cheat-sheet` to see a roster of go-to `gcloud` commands.

輸入gcloud projects describe [YOUR_PROJECT_ID]確認專案已經建立。

C:\Program Files (x86)\Google\Cloud SDK>gcloud projects describe [YOUR_PROJECT_ID]
createTime: '2026-10-21T07:54:38.536Z'
lifecycleState: ACTIVE
name: [YOUR_PROJECT_NAME]
projectId: [YOUR_PROJECT_ID]
projectNumber: [YOUR_PROJECT_NUMBER]

到此便完成Google Cloud CLI的安裝,及建立一個project。


沒有留言:

AdSense