All Products
Search
Document Center

Alibaba Cloud CLI:Windows

最終更新日:Aug 26, 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.

    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. In the Edit environment variable dialog box, click New on the left, enter the directory in which the aliyun.exe file is stored, and then click OK. The configuration is complete.

    Use CMD

    Procedure

    Open the Command Prompt as an administrator and run the following command to modify the system-level environment variable PATH.

    Note

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

    setx PATH "%PATH%;<CLI_PATH>" /M

    Usage notes

    • /M indicates that the environment variable is of the system level. You can choose not to use this parameter when you configure a user-level environment variable.

    • If you configure a system-level environment variable, you need to restart the computer for the configuration to take effect. If you configure a user-level environment variable, you need to reopen the Command Prompt for the configuration to take effect.

    • If you want to configure only a temporary environment variable, you can change setx to set in the command without the need to reopen the Command Prompt.

    Use Windows PowerShell

    Procedure

    Note

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

    • Configure the PATH environment variable for the current user and restart Windows PowerShell. The configuration takes effect on all new sessions.

      $newPath=[Environment]::GetEnvironmentVariable("PATH","User")+";<CLI_PATH>"
      [Environment]::SetEnvironmentVariable("PATH",$newPath,[System.EnvironmentVariableTarget]::User)
    • Configure the PATH environment variable for all users as an administrator and restart the computer.

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

      $newPath=[Environment]::GetEnvironmentVariable("PATH","User")+";<CLI_PATH>"
      [Environment]::SetEnvironmentVariable("PATH",$newPath,[System.EnvironmentVariableTarget]::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