All Products
Search
Document Center

Alibaba Cloud CLI:Windows

最終更新日:Oct 21, 2024

This topic describes how to install Alibaba Cloud CLI on Windows.

Procedure

  1. Download the installation package of Alibaba Cloud CLI for Windows.

    You can download the installation package in one of the following ways:

    • Download the installation package of Alibaba Cloud CLI of the latest version from the official website.

    • Download the installation package of Alibaba Cloud CLI of a random version from GitHub based on your business requirements.

  2. Decompress the installation package to obtain the executable file named aliyun.exe. You can move the aliyun.exe file to the directory in which you want to install Alibaba Cloud CLI.

    Note

    If you move the aliyun.exe file to the directory in which you want to install Alibaba Cloud CLI, use the directory to configure the PATH environment variable.

  3. Configure an environment variable.

    (Recommended) Use GUI

    Procedure

    The following example shows how to configure the PATH environment variable by using the GUI in Windows 10:

    1. On the Windows desktop, right-click This PC and select Properties. On the page that appears, click Advanced system settings. In the System Properties dialog box, click Environment Variables on the Advanced tab.

    2. In the Environment Variables dialog box, select the PATH environment variable and click Edit in the User variables or System variables section.

    3. In the Edit environment variable dialog box, click New, enter the directory in which the aliyun.exe file is stored.

    4. Click OK. The configuration is complete.

    Use CMD

    Procedure

    Open the Command Prompt as an administrator and run the following command to configure the PATH environment variable.

    Note

    You need to replace <CLI_PATH> in the command with the directory in which the aliyun.exe file is stored.

    • Configure the user-level environment variable and restart CMD. The configuration takes effect on all new sessions.

      setx PATH "%PATH%;<CLI_PATH>"
    • Configure the system-level environment variable as an administrator and restart the computer.

      setx PATH "%PATH%;<CLI_PATH>" /M
    • Configure a temporary environment variable that is valid only for the current session.

      set PATH="%PATH%;<CLI_PATH>"

    Use Windows PowerShell

    Important

    Windows PowerShell supports multiple language modes. The language mode determines the PowerShell language elements that are used in a session. The following commands are available only in the FullLanguage language mode. You can run the echo $ExecutionContext.SessionState.LanguageMode command to view the current language mode.

    Procedure

    Note

    You need to replace <CLI_PATH> in the command with the directory in which the aliyun.exe file is stored.

    • Configure the user-level environment variable and restart Windows PowerShell. The configuration takes effect on all new sessions.

      [Environment]::SetEnvironmentVariable("PATH",$env:Path+";<CLI_PATH>","User")
    • Configure the system-level environment variable as an administrator and restart the computer.

      [Environment]::SetEnvironmentVariable("PATH",$env:Path+";<CLI_PATH>","Machine")
    • Configure a temporary environment variable that is valid only for the current session.

      [Environment]::SetEnvironmentVariable("PATH",$env:Path+";<CLI_PATH>","Process")

Verify the installation

  1. Run the following command on the terminal to check whether Alibaba Cloud CLI is installed:

aliyun version
  1. If the system displays a version number of Alibaba Cloud CLI similar to the following example, Alibaba Cloud CLI is installed.

3.0.16