Running shell commands in windows

Windows commands

All supported versions of Windows (server and client) have a set of Win32 console commands built in.

This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.

Prerequisites

The information that is contained in this topic applies to:

  • Windows Server 2019
  • Windows Server (Semi-Annual Channel)
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2
  • Windows Server 2008
  • Windows 10
  • Windows 8.1

Command shell overview

The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all Commands that are available at the command line.

Windows has two command shells: The Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.

PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.

You can also download and install PowerShell Core, the open source version of PowerShell.

Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.

To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:

To set the reg_DWOrd value, use the hexadecimal value of a control character for a particular function (for example, 0 9 is Tab and 0 08 is Backspace). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Command-line reference A-Z

To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

How to run .sh or Shell Script file in Windows 10

Shell Scripts or .SH files are like batch files of Windows which can be executed in Linux or Unix. It is possible to run .sh or Shell Script file in Windows 10 using Windows Subsystem for Linux. In this post, we will show you how to run a Shell Script file in Windows 10.

Читайте также:  Ahk windows 10 не работает

How to run .sh or Shell Script file in Windows 10

Bash is a Unix shell and command language which can run Shell Script files. You do not need to install Ubuntu or any other Linux Distros unless your scripts need the support of the real Linux kernel. We will share both the methods.

  1. Execute Shell Script file using WSL
  2. Execute Shell Script using Ubuntu on Windows 10

1] Execute Shell Script file using WSL

Install WSL or Windows Subsystem for Linux

Go to Settings > Update & Security > For Developers. Check the Developer Mode radio button. And search for “Windows Features”, choose “Turn Windows features on or off”.

Scroll to find WSL, check the box, and then install it. Once done, one has to reboot to finish installing the requested changes. Press Restart now. BASH will be available in the Command Prompt and PowerShell.

Execute Shell Script Files

  1. Open Command Prompt and navigate to the folder where the script file is available.
  2. Type Bash script-filename.sh and hit the enter key.
  3. It will execute the script, and depending on the file, you should see an output.

On a Linux platform, you usually use SH, but here you need to use BASH. That said, BASH in Windows has its limitations, so if you want to execute in a Linux environment, you need to install Ubuntu or anything similar.

2] Execute Shell Script using Ubuntu on Windows 10

Make sure you have Ubuntu or any other Linux distros installed. Ubuntu will mount or make all your Windows directories available under /mnt. So the C drive is available at /mnt/C. So if the desktop will be available at /mnt/c/users/ /desktop.

Now follow these steps

  1. Type Bash in run prompt, and it will launch the distro prompt.
  2. Navigate to the folder using “cd” command to the folder where the scripts are available.
  3. Type “sh script.sh” and hit enter.

It will execute the script, and if they have a dependency on any of core Linux features.

Since Linux is now available in Windows, you need not use any third party applications like Cygwin. WSL should be enough for most of the scenarios to help you run a shell script in Windows 10.

Date: July 15, 2019 Tags: WSL

Windows Subsystem for Linux has no installed distributions

Failed to Fork error with Ubuntu on Windows 10

WslRegisterDistribution failed with error 0x8007019e and 0x8000000d – WSL

[email protected]

Ashish is a veteran Windows, and Xbox user who excels in writing tips, tricks, and features on it to improve your day to day experience with your devices.

Primary Sidebar

report this ad

Complete List of All Windows 10 Shell Commands

If you want to learn what are some of the most useful Shell commands used in Windows 10, as well as many other specific commands, read this guide. We bet you probably didn’t know some of these commends were even available up until now.

Accessing these commands is done by entering the “Run” feature in your Windows 10 operating system. Also, by using these Shell commands you will be able to access a specific system folder or one of the Control Panel applets you have available in your Windows 10 operating system.

Читайте также:  Windows 10 pro x64 rutracker org

List of Shell commands in Windows 10

First of all, you will need to press and hold the “Windows” button and the “R” button in order to bring up the “Run” window.

From the “Run” window you will need to write down one of the below commands and afterwards press the “Enter” button in order to access the specific feature.

Windows 10 Shell commands:

  1. “shell:AccountPictures”
    Note: this command accesses the account pictures folder you have in your Windows 10 device.
  2. “shell:AddNewProgramsFolder”
    Note: Adds a new program folder.
  3. “shell:Administrative Tools”
    Note: Accesses administrative tools folder.
  4. “shell:AppData”
    Note: Accesses AppData folder in the Windows 10 system.
  5. “shell:Application Shortcuts”
    Note: Accesses Application Shortcuts folder.
  6. “shell:AppsFolder”
    Note: Accesses the Apps Folder.
  7. “shell:AppUpdatesFolder”
    Note: Accesses the Apps updates folder.
  8. “shell:Cache”
    Note: Accesses the Cache folder.
  9. “shell:Camera Roll”
    Note: Access camera roll folder.
  10. “shell:CD Burning”
    Note: Accesses the temporary burn folder.
  11. “shell:ChangeRemoveProgramsFolder”
    Note: Accesses the Remove/Change program folder.
  12. “shell:Common Administrative Tools”
    Note: Accesses the Administrative Tools folder.
  13. “shell:Common AppData”
    Note: Accesses the Common AppData folder.
  14. “shell:Common Desktop”
    Note: Accesses the public desktop folder.
  15. “shell:Common Documents”
    Note: Accesses Public Documents folder.
  16. “shell:Common Programs”
    Note: Accesses Programs folder.
  17. “shell:Common Start Menu”
    Note: Accesses the start menu folder.
  18. “shell:Common Startup”
    Note: Accesses Startup folder situated in t he Windows 10 system.
  19. “shell:Common Templates”
    Note: Accesses “Common Templates” folder.
  20. “shell:CommonDownloads”
    Note: Accesses Downloads folder.
  21. “shell:CommonMusic”
    Note: Accesses the music folder.
  22. “shell:CommonPictures”
    Note: Accesses “Pictures” folder.
  23. “shell:CommonRingtones”
    Note: Accesses the ringtones folder.
  24. “shell:CommonVideo”
    Note: Accesses the public “Video” folder.
  25. “shell:ConflictFolder”
    Note: Accesses the “Conflict” folder in the Windows 10 system.
  26. “shell:ConnectionsFolder”
    Note: Opens up the connections folder
  27. “shell:Contacts”
    Note: Opens the Contact folder
  28. “shell:ControlPanelFolder”
    Note: Opens the Control panel folder.
  29. “shell:Cookies”
    Note: Opens the Cookies folder.
  30. “shell:CredentialManager”
    Note: Opens the Credential manager feature.
  31. “shell:CryptoKeys”
    Note: Opens up the Crypto keys folder
  32. “shell:CSCFolder”
    Note: Opens the CSC Folder.
  33. “shell:Desktop”
    Note: Opens up the Desktop folder.
  34. “shell:Device Metadata Store”
    Note: Opens the metadata store folder.
  35. “shell:DocumentsLibrary”
    Note: Opens the Documents Library folder
  36. “shell:Downloads”
    Note: Opens the Downloads folder
  37. “shell:DpapiKeys”
    Note: Opens the DpapiKeys folder
  38. “shell:Favorites”
    Note: Opens the Favorites folder.
  39. “shell:Fonts”
    Note: Opens the Fonts folder.
  40. “shell:Games”
    Note: Opens the Games folder.
  41. “shell:GameTasks”
    Note: Opens the Game Tasks folder
  42. “shell:History”
    Note: Opens the History folder
  43. “shell:HomeGroupCurrentUserFolder”
    Note: Opens the HomeGroup folder for the current user.
  44. “shell:HomeGroupFolder”
    Note: Opens HomeGroup folder.
  45. “shell:ImplicitAppShortcuts”
    Note: Opens the Implicit Apps shortcut folder.
  46. “shell:InternetFolder”
    Note: Opens Internet Folder.
  47. “shell:Libraries”
    Note: Opens Libraries folder.
  48. “shell:Links”
    Note: Opens the Links folder.
  49. “shell:Local AppData”
    Note: Opens Local AppData folder.
  50. “shell:LocalAppDataLow”
    Note: Opens Local AppDataLow folder.
  51. “shell:LocalizedResourcesDir”
    Note: Opens LocalizedResources folder.
  52. “shell:MAPIFolder”
    Note: Opens MAPI folder.
  53. “shell:MusicLibrary”
    Note: Opens LusicLibrary folder.
  54. “shell:My Music”
    Note: Opens My Music folder.
  55. “shell:My Video”
    Note: Opens My Video folder.
  56. “shell:MyComputerFolder”
    Note: Opens MyComputer folder.
  57. “shell:NetHood”
    Note: Opens NetHood folder.
  58. “shell:NetworkPlacesFolder”
    Note: Opens NetworkPlaces folder.
  59. “shell:OEM Links”
    Note: Opens OEM Links folder.
  60. “shell:OneDrive”
    Note: Opens OneDrive folder in Windows 10
  61. “shell:Original Images”
    Note: Opens Original Images folder.
  62. “shell:Personal”
    Note: Opens Personal folder.
  63. “shell:PhotoAlbums”
    Note: Opens PhotoAlbums folder.
  64. “shell:PicturesLibrary”
    Note: opens PicturesLibrary folder.
  65. “shell:Playlists”
    Note: Opens Playlists folder.
  66. “shell:PrintersFolder”
    Note: Opens Printer folder.
  67. “shell:PrintHood”
    Note: Opens PrintHood folder.
  68. “shell:Profile”
    Note: Opens Profile folder.
  69. “shell:ProgramFiles”
    Note: Opens ProgramFiles folder.
  70. “shell:ProgramFilesCommon”
    Note: Opens ProgramFilesCommon folder.
  71. “shell:ProgramFilesCommonX64”
    Note: Opens ProgramFilesCommonX64 folder.
  72. “shell:ProgramFilesCommonX86”
    Note: Opens ProgramFilesCommonX86 folder.
  73. “shell:ProgramFilesX64”
    Note: Opens ProgramFilesX64 folder.
  74. “shell:ProgramFilesX86”
    Note: Opens ProgramFilesX86 folder.
  75. “shell:Programs”
    Note: Opens Programs folder.
  76. “shell:Public”
    Note: Opens Public folder.
  77. “shell:PublicAccountPictures”
    Note: Opens PublicAccountPictures folder.
  78. “shell:PublicGameTasks”
    Note: Opens PublicGameTasks folder.
  79. “shell:PublicLibraries”
    Note: Opens PublicLibraries folder.
  80. “shell:Quick Launch”
    Note: Opens Quick Launch folder.
  81. “shell:Recent”
    Note: Opens up recent items folder
  82. “shell:RecordedTVLibrary”
    Note: Opens up recorder file in the Windows 10 system
  83. “shell:RecycleBinFolder”
    Note: Opens the system Recycle Bin folder
  84. “shell:ResourceDir”
    Note: Opens up the Resource folder
  85. “shell:Retail Demo”
    Note: Opens up Demo folder
  86. “shell:Ringtones”
    Note: Opens up the Ringtones folder in Windows 10
  87. “shell:Roamed Tile Images”
    Note: Opens up the Roamed Tile images folder
  88. “shell:Roaming Tiles”
    Note: Opens the Roaming Tiles folder
  89. “shell:SavedGames”
    Note: It opens the SavedGames folder you have in the Windows 10 system
  90. “shell:Screenshots”
    Note: Opens the Screenshots folder
  91. “shell:Searches”
    Note: Opens the Search folder.
  92. “shell:SearchHistoryFolder”
    Note: Opens the Search History folder you have in the system.
  93. “shell:SearchHomeFolder”
    Note: Opens the Search Home folder.
  94. “shell:SearchTemplatesFolder”
    Note: Opens the Search templates folder.
  95. “shell:SendTo”
    Note: Opens the SendTo folder.
  96. “shell:SkyDriveCameraRoll”
    Note: Opens the SkyDriveCameraRoll folder.
  97. “shell:SkyDriveMusic”
    Note: Opens the SkyDriveMusic folder.
  98. “shell:SkyDrivePictures”
    Note: Opens the SkyDrivePictures folder.
  99. “shell:Start Menu”
    Note: Opens up the Start menu folder.
  100. “shell:StartMenuAllPrograms”
    Note: Opens the AllPrograms folder you have in the start menu.
  101. “shell:Startup”
    Note: Opens the Startup folder.
  102. “shell:SyncCenterFolder”
    Note: Opens the SyncCenter folder.
  103. “shell:SyncResultsFolder”
    Note: Opens the SyncResults folder.
  104. “shell:SyncSetupFolder”
    Note: opens the SyncSetup folder.
  105. “shell:System”
    Note: Opens the System folder.
  106. “shell:SystemCertificates”
    Note: Opens the SystemCertificates folder.
  107. “shell:SystemX86”
    Note: Opens SystemX86 folder.
  108. “shell:Templates”
    Note: Opens the Templates folder.
  109. “shell:ThisPCDesktopFolder”
    Note: Opens the ThisPCDesktop folder.
  110. “shell:User Pinned”
    Note: Opens User pinned folder.
  111. “shell:UserProfiles”
    Note: Opens the user profiles folder.
  112. “shell:UserProgramFiles”
    Note: Opens Program Files folder.
  113. “shell:UserProgramFilesCommon”
    Note: Opens Program Files Common folder.
  114. “shell:UsersFilesFolder”
    Note: Opens the Files folder from a specific user you are logged in with.
  115. “shell:UsersLibrariesFolder”
    Note: Opens the Libraries folder for a specific user.
  116. “shell:VideosLibrary”
    Note: Opens Video library folder.
  117. “shell:Windows”
    Note: Opens the “Windows” folder.
Читайте также:  Windows server 2012 isapi

Is it worth mentioning that you can use the commands listed above in CMD and File Explorer as well. If you prefer CMD, simply type start and then add the Shell command that you want to run. In File Explorer, you can use the address bar to enter the commands listed above.

There you have it, a quick way to access the Run window as well as all the available shell commands within the Windows 10 operating system. If you have any questions related to this guide, let us know in the comments below and we will help you as soon as we can.

RELATED STORIES TO CHECK OUT:

Оцените статью