This topic describes how to install Alibaba Cloud CLI on Windows.
Procedure
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.
Decompress the installation package to obtain the executable file named
aliyun.exe
. You can move thealiyun.exe
file to the directory in which you want to install Alibaba Cloud CLI.NoteIf 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.
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:
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.
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, enter the directory in which the
aliyun.exe
file is stored.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.NoteYou need to replace
<CLI_PATH>
in the command with the directory in which thealiyun.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
ImportantWindows 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 theecho $ExecutionContext.SessionState.LanguageMode
command to view the current language mode.Procedure
NoteYou need to replace
<CLI_PATH>
in the command with the directory in which thealiyun.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
Run the following command on the terminal to check whether Alibaba Cloud CLI is installed:
aliyun version
If the system displays a version number of Alibaba Cloud CLI similar to the following example, Alibaba Cloud CLI is installed.
3.0.16