Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Platform overview
  • Getting started
    • Platform architecture
    • Regions
    • Network overview
    • Public IP address ranges
    • User interaction with resources
    • Deleting user data
    • Service list
    • Release stages
    • Observability (monitoring and logging) tools
    • SLA
    • Quotas and limits
    • Release notes
    • Troubleshooting
    • Overview
    • Mobile app
    • API
    • Working with the Yandex Cloud CLI and API in Microsoft Windows

In this article:

  • How to run Bash commands in the Windows terminal
  • How to adapt your code to command line shells native for Windows
  • Replace basic syntax elements
  • Check the format of equivalent commands
  • Replace other commands with their equivalents
  • Check the names of system variables and auxiliary syntax
  1. Service interfaces
  2. Working with the Yandex Cloud CLI and API in Microsoft Windows

Working with the Yandex Cloud CLI and API in Microsoft Windows

Written by
Yandex Cloud
Updated at April 26, 2024
  • How to run Bash commands in the Windows terminal
  • How to adapt your code to command line shells native for Windows
    • Replace basic syntax elements
    • Check the format of equivalent commands
    • Replace other commands with their equivalents
    • Check the names of system variables and auxiliary syntax

Yandex Cloud services provide a variety of interfaces for implementing your projects. Usually, Yandex Cloud services have a web interface in the management console or within their installations, such as Yandex DataLens and Yandex DataSphere. In addition, they have interfaces designed to automate processes: API, CLI, Terraform, and SDKs for different programming languages. You can read more about the provided interfaces in the respective service documentation.

The Yandex Cloud documentation contains step-by-step guides for working with different interfaces. Sample CLI commands and API requests usually use the Bash syntax. You can run them as is in the Linux console, macOS terminal, or WSL in Windows 10 and higher.

If you use Yandex Cloud in Windows with no WSL, sample CLI commands and API requests may run incorrectly. To use the examples provided in the documentation, install the Bash interface on your PC, create a VM to work with Yandex Cloud, or adapt commands to the syntax of the Windows command shell you use. For more information on Windows command shells, see the official Microsoft documentation.

How to run Bash commands in the Windows terminalHow to run Bash commands in the Windows terminal

WSL
Bash emulators

Windows Subsystem for Linux is available for Windows 10 or higher.

  1. To check whether WSL is installed on your PC, run the following command in cmd or PowerShell:

    wsl -u root
    

    If WSL is installed, the terminal will switch to Bash mode:

    root@<machine_name>:/mnt/c/Users/<username>#
    
  2. If not, install WSL and repeat the previous step.

If you are using Windows without WSL, you can install a Bash emulator, such as Git Bash.

How to adapt your code to command line shells native for WindowsHow to adapt your code to command line shells native for Windows

If you want to run your Bash code in cmd or PowerShell, bring it to the appropriate format:

  1. Replace basic syntax elements.
  2. Check the format of equivalent commands.
  3. Replace other commands with their equivalents.
  4. Check the names of system variables and auxiliary syntax.

Replace basic syntax elementsReplace basic syntax elements

  1. Replace the directory separator in file paths: / in Linux and \ in Windows.

  2. Replace line break characters. Instead of \, use ^ in cmd and ` in PowerShell.

  3. Check out the rules for using all kinds of quotation marks, as they are handled differently in Linux and PowerShell.

  4. Check out the syntax for using variables.

    Examples of using variables
    Action Linux Windows cmd PowerShell
    Writing a variable export VAR="1" set VAR="1" $Env:VAR="1"
    Reading a variable ${VAR} %VAR% $Env:VAR

Check the format of equivalent commandsCheck the format of equivalent commands

Many commands in cmd and PowerShell have aliases similar to Bash commands. For example, the Set-Location PowerShell command (change to a different directory) will be run if you type cdin the terminal.
If the code execution fails:

  1. Check if the Bash command has an equivalent in your terminal. For example, in PowerShell, run:

    alias
    

    This will output a list of all aliases defined in the system settings:

    CommandType     Name                            Version    Source
    -----------     ----                            -------    ------
    Alias           % -> ForEach-Object
    Alias           ? -> Where-Object
    Alias           ac -> Add-Content
    Alias           asnp -> Add-PSSnapin
    Alias           cat -> Get-Content
    Alias           cd -> Set-Location
    Alias           CFS -> ConvertFrom-String       3.1.0.0    Microsoft.PowerShell.Utility
    Alias           chdir -> Set-Location
    Alias           clc -> Clear-Content
    Alias           clear -> Clear-Host
    
    ...
    
    

    For a complete list of aliases, see the alias command output.

  2. Make sure the command in your command shell performs the same function as its equivalent Bash command.

  3. Check the command format: the alias keys may differ. For example, the ls command has an alias in PowerShell, but the argument keys differ.

Replace other commands with their equivalentsReplace other commands with their equivalents

  1. If a command has no alias, find its equivalent.

    List of equivalent commands in Linux, cmd, and PowerShell
    Action Linux Windows cmd Windows PowerShell
    List files in a directory ls -s dir dir, ls, Get-ChildItem
    List files in a directory and sub-directories ls -R tree ls, Get-ChildItem
    Create a file touch copy nul > New-Item
    Rename a file mv ren ren, Rename-Item
    Copy a file cp copy copy, Copy-Item
    Move a file mv move move, Move-Item
    Delete a file rm del del, Remove-Item
    Compare file content diff fc diff, Get-Content, Compare-Object
    Find file strings or object properties grep find Select-String, Where-Object
    Output command help man <command> <command> /? Get-Help <command>
    Output the name of the current directory pwd cd $PWD
    Create directory mkdir md mkdir, New-Item
    Output current date and time date time Get-Date
    Configure file access policies chown, chmod attrib attrib, Set-XFileOwner
    Schedule the command run cron at schtasks, Register-ScheduledJob
    Access a web resource over HTTP wget wget Invoke-WebRequest
  2. If a command has no direct equivalent, you can perform the same action using a combination of commands or other methods. For example, to convert a file to Base64 in PowerShell, use the static Convert method: [Convert]::ToBase64String([IO.File]::ReadAllBytes(''<filename>'')).

  3. Consider the specifics of your command shell. For example, PowerShell works with objects and their properties rather than text. Therefore, instead of searching by grep, you will need to use the Where-Object PowerShell command in most cases. It handles objects with required property values. To search for a sequence of characters, use the Select-String command.

Check the names of system variables and auxiliary syntaxCheck the names of system variables and auxiliary syntax

  1. Check the names of environment variables. For example, instead of the USER environment variable used in Linux, the USERNAME variable is used in Windows.
  2. If your code contains comparison, selection, or loop statements, change the syntax to meet the requirements of your command shell. To learn more about the difference between the Bash and PowerShell auxiliary syntax, see Bash vs PowerShell Cheat Sheet.

Was the article helpful?

Previous
Getting started
Next
Overview
© 2025 Direct Cursus Technology L.L.C.