Windows server shell commands

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.

Команда Shell Shell Command

Запускает исполняемые программы из Visual Studio Visual Studio . Launches executable programs from within Visual Studio Visual Studio .

Синтаксис Syntax

Аргументы Arguments

Обязательный. Required. Путь и имя исполняемого файла или открываемого документа. The path and file name of the file to execute or the document to open. Полный путь требуется, если указанный файл не находится в одном из каталогов, заданных в переменной среды PATH. A full path is required if the specified file is not in one of the directories in the PATH environment variable.

Читайте также:  Установка тем для windows 10 не работает

Необязательный элемент. Optional. Все аргументы, передаваемые в вызванную программу. Any arguments to pass to the invoked program.

Коммутаторы Switches

/commandwindow [или] /command [или] /c [или] /cmd /commandwindow [or] /command [or] /c [or] /cmd

Необязательный элемент. Optional. Указывает, что выходные данные для исполняемого файла отображаются в окне Команда. Specifies that the output for the executable is displayed in the Command window.

/dir: folder [или] /d: folder /dir: folder [or] /d: folder

Необязательный элемент. Optional. Указывает рабочий каталог, задаваемый при запуске программы. Specifies the working directory to be set when the program is run.

/outputwindow [или] /output [или] /out [или] /o /outputwindow [or] /output [or] /out [or] /o

Необязательный элемент. Optional. Указывает, что выходные данные для исполняемого файла отображаются в окне Вывод. Specifies that the output for the executable is displayed in the Output window.

Remarks Remarks

Параметры /dir /o /c должны быть указаны сразу после Tools.Shell . The /dir /o /c switches must be specified immediately after Tools.Shell . Все, что указано после имени исполняемого файла, передается в виде аргументов командной строки. Anything specified after the name of the executable is passed to it as command line arguments.

Вместо Tools.Shell можно использовать предопределенный псевдоним Shell . The predefined alias Shell can be used in place of Tools.Shell .

Если аргумент path указывает путь к каталогу, а также имя файла, следует заключить все имя пути в кавычки («»»), как показано ниже: If the path argument supplies the directory path as well as the file name, you should enclose the entire pathname in literal quotes («»»), as in the following:

Каждый набор из трех двойных кавычек («»») интерпретируется процессором Shell как один символ двойной кавычки. Each set of three double quotes («»») is interpreted by the Shell processor as a single double quote character. Таким образом, предыдущий пример фактически передает в команду Shell следующую строку пути: Thus, the preceding example actually passes the following path string to the Shell command:

OpenSSH Server Configuration for Windows 10 1809 and Server 2019

This topic covers the Windows-specific configuration for OpenSSH Server (sshd).

OpenSSH maintains detailed documentation for configuration options online at OpenSSH.com, which is not duplicated in this documentation set.

Configuring the default shell for OpenSSH in Windows

The default command shell provides the experience a user sees when connecting to the server using SSH. The initial default Windows is the Windows Command shell (cmd.exe). Windows also includes PowerShell and Bash, and third party command shells are also available for Windows and may be configured as the default shell for a server.

To set the default command shell, first confirm that the OpenSSH installation folder is on the system path. For Windows, the default installation folder is SystemDrive:WindowsDirectory\System32\openssh. The following commands shows the current path setting, and add the default OpenSSH installation folder to it.

Command shell Command to use
Command path
PowerShell $env:path

Configuring the default ssh shell is done in the Windows registry by adding the full path to the shell executable to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH in the string value DefaultShell.

As an example, the following Powershell command sets the default shell to be PowerShell.exe:

Windows Configurations in sshd_config

In Windows, sshd reads configuration data from %programdata%\ssh\sshd_config by default, or a different configuration file may be specified by launching sshd.exe with the -f parameter. If the file is absent, sshd generates one with the default configuration when the service is started.

The elements listed below provide Windows-specific configuration possible through entries in sshd_config. There are other configuration settings possible in that are not listed here, as they are covered in detail in the online Win32 OpenSSH documentation.

AllowGroups, AllowUsers, DenyGroups, DenyUsers

Controlling which users and groups can connect to the server is done using the AllowGroups, AllowUsers, DenyGroups and DenyUsers directives. The allow/deny directives are processed in the following order: DenyUsers, AllowUsers, DenyGroups, and finally AllowGroups. All account names must be specified in lower case. See PATTERNS in ssh_config for more information on patterns for wildcards.

When configuring user/group based rules with a domain user or group, use the following format: user?domain* . Windows allows multiple of formats for specifying domain principals, but many conflict with standard Linux patterns. For that reason, * is added to cover FQDNs. Also, this approach uses «?», instead of @, to avoid conflicts with the username@host format.

Work group users/groups and internet-connected accounts are always resolved to their local account name (no domain part, similar to standard Unix names). Domain users and groups are strictly resolved to NameSamCompatible format — domain_short_name\user_name. All user/group based configuration rules need to adhere to this format.

Examples for domain users and groups

Examples for local users and groups

AuthenticationMethods

For Windows OpenSSH, the only available authentication methods are «password» and «publickey».

AuthorizedKeysFile

The default is «.ssh/authorized_keys .ssh/authorized_keys2». If the path is not absolute, it is taken relative to user’s home directory (or profile image path). Ex. c:\users\user. Note that if the user belongs to the administrator group, %programdata%/ssh/administrators_authorized_keys is used instead.

ChrootDirectory (Support added in v7.7.0.0)

This directive is only supported with sftp sessions. A remote session into cmd.exe wouldn’t honor this. To setup a sftp-only chroot server, set ForceCommand to internal-sftp. You may also set up scp with chroot, by implementing a custom shell that would only allow scp and sftp.

HostKey

The defaults are %programdata%/ssh/ssh_host_ecdsa_key, %programdata%/ssh/ssh_host_ed25519_key, %programdata%/ssh/ssh_host_dsa_key, and %programdata%/ssh/ssh_host_rsa_key. If the defaults are not present, sshd automatically generates these on a service start.

Match

Note that pattern rules in this section. User and group names should be in lower case.

PermitRootLogin

Not applicable in Windows. To prevent administrator login, use Administrators with DenyGroups directive.

SyslogFacility

If you need file based logging, use LOCAL0. Logs are generated under %programdata%\ssh\logs. For any other value, including the default value, AUTH directs logging to ETW. For more info, see Logging Facilities in Windows.

Not supported

The following configuration options are not available in the OpenSSH version that ships in Windows Server 2019 and Windows 10 1809:

  • AcceptEnv
  • AllowStreamLocalForwarding
  • AuthorizedKeysCommand
  • AuthorizedKeysCommandUser
  • AuthorizedPrincipalsCommand
  • AuthorizedPrincipalsCommandUser
  • Compression
  • ExposeAuthInfo
  • GSSAPIAuthentication
  • GSSAPICleanupCredentials
  • GSSAPIStrictAcceptorCheck
  • HostbasedAcceptedKeyTypes
  • HostbasedAuthentication
  • HostbasedUsesNameFromPacketOnly
  • IgnoreRhosts
  • IgnoreUserKnownHosts
  • KbdInteractiveAuthentication
  • KerberosAuthentication
  • KerberosGetAFSToken
  • KerberosOrLocalPasswd
  • KerberosTicketCleanup
  • PermitTunnel
  • PermitUserEnvironment
  • PermitUserRC
  • PidFile
  • PrintLastLog
  • RDomain
  • StreamLocalBindMask
  • StreamLocalBindUnlink
  • StrictModes
  • X11DisplayOffset
  • X11Forwarding
  • X11UseLocalhost
  • XAuthLocation

—>

A List of All Windows Shell Commands

Windows 10 has a variety of shell commands to open important folders quickly. One of the best things about Windows shell commands is that they allow you to launch deeply buried folders with a single command. For example, if you want to open the Printer devices page, you don’t have to dig through the Control Panel settings. You can just use the shell command.

I regularly use the shell commands to open all kinds of folders. Once you get used to and remember the frequently used shell commands, it is quite easy to use. Since Windows 10 has a lot of shell commands, I’ve assembled a simple list of all the shell commands you can use in Windows 10.

Use them as you need. If you want to, bookmark this page so that you can take a quick look if you ever forget your favorite Windows shell command.

Windows Shell Commands List

Below is the list all the known and useful Windows 10 Shell Commands. For ease of reading, I’ve listed them in a table format. Each and every command is very self-explanatory. For instance, shell:Start Menu will open the Start Menu folder. shell:Downloads will open your Downloads folder.

S.No Windows Shell Command
1 shell:SendTo
2 shell:Start Menu
3 shell:Startup
4 shell:Common Startup
5 shell:Recent
6 shell:Roaming Tiles
7 shell:CommonVideo
8 shell:OneDrivePictures
9 shell:PrintersFolder
10 shell:Common Programs
11 shell:Camera Roll
12 shell:Templates
13 shell:InternetFolder
14 shell:AppDataDocuments
15 shell:My Pictures
16 shell:UserProgramFiles
17 shell:PrintHood
18 shell:MyComputerFolder
19 shell:ProgramFilesX86
20 shell:My Video
21 shell:Common Templates
22 shell:NetworkPlacesFolder
23 shell:Public
24 shell:NetHood
25 shell:AccountPictures
26 shell:ProgramFilesCommon
27 shell:SearchHistoryFolder
28 shell:CSCFolder
29 shell:Recorded Calls
30 shell:Local Downloads
31 shell:AppDataProgramData
32 shell:PublicLibraries
33 shell:ProgramFilesX64
34 shell:ProgramFilesCommonX86
35 shell:Administrative Tools
36 shell:UserProfiles
37 shell:PublicAccountPictures
38 shell:SearchTemplatesFolder
39 shell:ThisDeviceFolder
40 shell:Cookies
41 shell:Local Pictures
42 shell:ImplicitAppShortcuts
43 shell:VideosLibrary
44 shell:ResourceDir
45 shell:Windows
46 shell:Device Metadata Store
47 shell:ThisPCDesktopFolder
48 shell:Common Administrative Tools
49 shell:System
50 shell:History
51 shell:Personal
52 shell:Quick Launch
53 shell:Links
54 shell:User Pinned
55 shell:MusicLibrary
56 shell:Common Start Menu
57 shell:Ringtones
58 shell:Original Images
59 shell:AppDataFavorites
60 shell:ProgramFilesCommonX64
61 shell:LocalizedResourcesDir
62 shell:My Music
63 shell:Desktop
64 shell:AddNewProgramsFolder
65 shell:CommonPictures
66 shell:ControlPanelFolder
67 shell:SavedGames
68 shell:Common AppData
69 shell:DpapiKeys
70 shell:SavedPictures
71 shell:OneDriveMusic
72 shell:CommonDownloads
73 shell:GameTasks
74 shell:Cache
75 shell:PublicGameTasks
76 shell:Retail Demo
77 shell:PhotoAlbums
78 shell:Common Documents
79 shell:ChangeRemoveProgramsFolder
80 shell:MAPIFolder
81 shell:CommonRingtones
82 shell:Searches
83 shell:Programs
84 shell:SystemCertificates
85 shell:Local Documents
86 shell:PicturesLibrary
87 shell:CryptoKeys
88 shell:RecordedTVLibrary
89 shell:Contacts
90 shell:Local Videos
91 shell:AppDataDesktop
92 shell:OneDrive
93 shell:OEM Links
94 shell:OneDriveDocuments
95 shell:HomeGroupFolder
96 shell:Common Start Menu Places
97 shell:AppMods
98 shell:ConflictFolder
99 shell:CD Burning
100 shell:Fonts
101 shell:CommonMusic
102 shell:Captures
103 shell:Development Files
104 shell:HomeGroupCurrentUserFolder
105 shell:SyncCenterFolder
106 shell:RecycleBinFolder
107 shell:3D Objects
108 shell:LocalAppDataLow
109 shell:SearchHomeFolder
110 shell:Application Shortcuts
111 shell:Downloads
112 shell:Favorites
113 shell:CameraRollLibrary
114 shell:Screenshots
115 shell:SavedPicturesLibrary
116 shell:Profile
117 shell:ConnectionsFolder
118 shell:Local AppData
119 shell:OneDriveCameraRoll
120 shell:ProgramFiles
121 shell:Common Desktop
122 shell:CredentialManager
123 shell:SyncResultsFolder
124 shell:AppData
125 shell:Libraries
126 shell:DocumentsLibrary
127 shell:SyncSetupFolder
128 shell:AppsFolder
129 shell:Roamed Tile Images
130 shell:UserProgramFilesCommon
131 shell:SystemX86
132 shell:Local Music
133 shell:UsersFilesFolder
134 shell:Playlists
135 shell:UsersLibrariesFolder
136 shell:AppUpdatesFolder

How to Use Windows Shell Commands

Using Windows shell commands is pretty easy. First, open the Run dialog box by pressing the keyboard shortcut Win + R . Next, copy the shell command of your choice, paste it in the blank field and click on the Ok button or press the Enter key on your keyboard.

As soon as you click on the Ok button, the respective folder will open in the File Explorer.

That is all. If you like this list article, do check out our other useful lists too.

Читайте также:  Семейства windows рядом с
Оцените статью