TVs. Consoles. Projectors and accessories. Technologies. Digital TV

Windows command line syntax. Programming in Cmd introduction for beginners. Using command history and hotkeys

In Windows 7, there are operations that are impossible or difficult to perform through a regular graphical interface, but they can actually be carried out through the Command Line interface using the CMD.EXE interpreter. Let's look at the basic commands that users can use when using this tool.

Using commands in the Command Prompt, you launch various utilities and perform certain operations. Often the main command expression is used together with a number of attributes, which are written separated by a slash ( / ). It is these attributes that initiate the execution of specific operations.

We do not set ourselves the goal of describing absolutely all the commands used when using the CMD.EXE tool. To do this, I would have to write more than one article. We will try to fit information about the most useful and popular command expressions on one page, dividing them into groups.

Launching system utilities

First of all, let's look at the expressions that are responsible for launching important system utilities.

CHKDSK– launches the Check Disk utility, which checks the computer’s hard drives for errors. This command expression can be entered with additional attributes, which, in turn, trigger the execution of certain operations:

  • /f– disk recovery in case of detection of logical errors;
  • /r– restoration of drive sectors in case of detection of physical damage;
  • /x– disconnecting the specified hard drive;
  • /scan– proactive scanning;
  • C:, D:, E: …— specifying logical drives for scanning;
  • /? – call up help about the operation of the Check Disk utility.

SFC– launch the utility for checking the integrity of Windows system files. This command expression is most often used with the attribute /scannow. It runs a tool that checks OS files for compliance with standards. In case of damage, if you have an installation disk, it is possible to restore the integrity of system objects.

Working with files and folders

The next group of expressions is designed to work with files and folders.

APPEND– opening files in a user-specified folder as if they were in the required directory. A prerequisite is to indicate the path to the folder to which the action will be applied. The recording is made according to the following template:

append [;] [[computer drive:]path[;...]]

When using this command, you can apply the following attributes:

  • /e– recording a complete list of files;
  • /? – launch help.

ATTRIB– the command is intended to change the attributes of files or folders. Just as in the previous case, a prerequisite is to enter, along with a command expression, the full path to the object being processed. The following keys are used to set attributes:

  • h– hidden;
  • s– systemic;
  • r– read only;
  • a– archival.

In order to apply or disable an attribute, the sign is placed in front of the key accordingly «+» or «-» .

COPY– used to copy files and directories from one directory to another. When using the command, be sure to indicate the full path of the copy object and the folder into which it will be performed. The following attributes can be used with this command expression:

  • /v– checking the correctness of copying;
  • /z– copying objects from the network;
  • /y– rewriting the final object if the names match without confirmation;
  • /? – activation of help.

DEL– deleting files from the specified directory. The command expression allows for the use of a number of attributes:

  • /p– enabling a request to confirm deletion before manipulating each object;
  • /q– disable the request when deleting;
  • /s– deleting objects in directories and subdirectories;
  • /a:— deleting objects with the specified attributes, which are assigned using the same keys as when using the command ATTRIB.

R.D.– is analogous to the previous command expression, but deletes not files, but folders in the specified directory. When used, the same attributes can be applied.

DIR– displays a list of all subdirectories and files that are located in the specified directory. The following attributes are used along with the main expression:

  • /q– obtaining information about the owner of the file;
  • /s– displaying a list of files from the specified directory;
  • /w– displaying a list in several columns;
  • /o– sorting the list of displayed objects ( e– by extension; n- by name; d– by date; s- by size);
  • /d– display a list in several columns with sorting by these columns;
  • /b– display only file names;
  • /a– displays objects with certain attributes, which are specified using the same keys as when using the ATTRIB command.

REN– used to rename directories and files. The path to the object and its new name are specified as arguments to this command. For example, to rename the file file.txt, which is located in the folder "Folder" located in the root directory of the disk D, in the file file2.txt, you need to enter the following expression:

REN D:\folder\file.txt file2.txt

M.D.– is intended for creating a new folder. In the command syntax, you must specify the drive on which the new directory will be located, and the directory where it will be located if it is nested. For example, to create a directory folderN, which is located in the directory folder on disk E, you should enter the following expression:

md E:\folder\folderN

Working with text files

The next block of commands is designed to work with text.

TYPE– displays the contents of text files on the screen. The required arguments to this command are the full path to the object whose text should be viewed. For example, to view the contents of the file file.txt located in the folder "Folder" on disk D, you need to enter the following command expression:

TYPE D:\folder\file.txt

PRINT– prints the contents of a text file. The syntax of this command is similar to the previous one, but instead of displaying text on the screen, it is printed.

FIND– searches for a text string in files. Along with this command, the path to the object in which the search is performed must be indicated, as well as the name of the searched string, enclosed in quotation marks. In addition, the following attributes apply with this expression:

  • /c– displays the total number of lines containing the searched expression;
  • /v– output lines that do not contain the search expression;
  • /I– case insensitive search.

Working with accounts

Using the command line, you can view and manage information about system users.

FINGER– displaying information about users registered in the operating system. The required argument of this command is the name of the user about whom you want to obtain data. Alternatively, you can use the attribute /i. In this case, the information will be displayed in a list format.

TSCON– attaches a user session to a terminal session. When using this command, you must specify the session ID or its name, as well as the password of the user to whom it belongs. The password should be specified after the attribute /PASSWORD.

Working with Processes

The next block of commands is designed to control processes on the computer.

QPROCESS– providing data about running processes on a PC. The information displayed will include the name of the process, the name of the user who launched it, the session name, ID and PID.

TASKKILL– used to terminate processes. The required argument is the name of the element that needs to be stopped. It is indicated after the attribute /IM. You can also terminate not by name, but by process ID. In this case the attribute is used /PID.

Networking

Using the command line, it is possible to manage various network activities.

GETMAC– starts displaying the MAC address of the network card connected to the computer. If there are several adapters, all their addresses are displayed.

NETSH– initiates the launch of the utility of the same name, which is used to display information about network parameters and change them. This command, due to its very broad functionality, has a huge number of attributes, each of which is responsible for performing a specific task. To obtain detailed information about them, you can use help using the following command expression:

NETSTAT– displaying statistical information about network connections.

Other commands

There are also a number of other command expressions used when using CMD.EXE that cannot be separated into separate groups.

TIME– viewing and setting the PC system time. When you enter this command expression, the current time is displayed on the screen, which can be changed to any other time in the very bottom line.

DATE– the syntax command is completely similar to the previous one, but is used not to display and change the time, but to launch these procedures in relation to the date.

SHUTDOWN– turns off the computer. This expression can be used both locally and remotely.

BREAK– disable or start the button combination processing mode Ctrl+C.

ECHO– displays text messages and is used to switch their display modes.

This is not a complete list of all commands that are used when using the CMD.EXE interface. Nevertheless, we tried to reveal the names, as well as briefly describe the syntax and main functions of the most popular ones, for convenience, dividing them into groups by purpose.

Good afternoon, readers. Today, once again, I had to go searching for the necessary information. Often you have to help Windows users directly from the user account, and there are no tools at hand other than those built into Windows cmd.exe command line. When working under a restricted account, you often need to perform some task with elevated Administrator rights. cmd for these tasks, the most suitable tool is that you do not have to enter the administrator password many times; you just need to run the command line once as an administrator and perform the necessary actions run the necessary commands which I will describe below:

appwiz.cpl- Installing and removing programs
certmgr.msc- Certificates
ciadv.msc- Indexing service
cliconfg- SQL Network Client Program
clipbrd- Clipboard
compmgmt.msc- Computer management
dcomcnfg- DCOM component management console
ddeshare- DDE Shares (does not work on Win7)
desk.cpl- Screen properties
devmgmt.msc- Device Manager
dfrg.msc- Disk defragmentation
diskmgmt.msc- Disk management
drwtsn32- Dr.Watson
dxdiag- DirectX Diagnostic Service
eudcedit- Personal symbol editor
eventvwr.msc- Event Viewer
firewall.cpl- Windows firewall settings
gpedit.msc- Group Policy
iexpress- IExpress (I don’t know what it is)
fsmgmt.msc - Shared folders
fsquirt- Bluetooth File Transfer Wizard
chkdsk- Disk check (usually launched with parameters drive_letter: /f /x /r)
control printers- Printers and faxes - does not always start
control admintools- Computer administration - does not always start
control scheduled tasks- Scheduled tasks (scheduler)
control userpasswords2 - Account Management
compmgmt.msc- Computer management ( compmgmt.msc /computer=pc- remote control of PC computer)
lusrmgr.msc- Local users and groups
mmc- creating your own equipment
mrt.exe- Malware removal
msconfig- System setup (autostart, services, etc...)
mstsc- Remote desktop connection
ncpa.cpl- Network connections
ntmsmgr.msc- Removable memory
ntmsoprq.msc- Removable RAM operator requests (for XP)
odbccp32.cpl- Data source administrator
perfmon.msc- Productivity
regedit- Registry editor
rsop.msc- Resulting policy
secpol.msc- Local Security Settings (Local Security Policy)
services.msc- Services
sfc /scannow- System file recovery
sigverif- File signature verification
sndvol- volume control
sysdm.cpl- System properties
sysedit - System file editor (don't know what it is)
syskey - Account database protection
taskmgr- Task Manager
utilman Utility Manager
verifier Driver Verification Manager
wmimgmt.msc- WMI management infrastructure

This list is mainly GUI applications. Below I will highlight console commands in a separate list.

You can also run applications in the Control Panel with administrator rights by right-clicking while holding down the Shift key. And select Run as (RunAs...) (relevant for Win XP).

List of console commands:

nbtstat -a pc- username of the user working on the remote PC machine
net localgroup group user /add- Add user to the group group
net localgroupgroup user/delete- Remove user from group
net send pc ""text"" - send a message to a PC user
net sessions- list of users
net session /delete- closes all network sessions
net use l: \\computer name\folder\- connect network drive l: folder on the remote computer
net user name /active:no- block the user
net user name /active:yes- unblock the user
net user name /domain- information about the domain user
net user Name /add- add user
net user Name /delete- delete user
netstat -a- list of all connections to the computer
reg add- Add a parameter to the registry
reg compare- Compare parts of the registry.
reg copy- Copies from one partition to another
reg delete- Removes the specified parameter or section
reg export- Export part of the registry
reg import- Accordingly, import part of the registry
reg load- Loads the selected part of the registry
reg query- Displays the values ​​of a given registry branch
reg restore- Restores the selected part of the registry from a file
reg save- Saves the selected part of the registry
reg unload- Unloads the selected part of the registry
shutdown- shutting down a computer, you can turn off another one remotely.
SystemInfo /s machine- will show a lot of useful information about the remote machine

This article will cover the basics Windows command line, namely:

  • Command line concept;
  • Shell Commands Reference;
  • Sequence of events when executing a command;
  • Creating command line scripts;
  • Controlling the display of text and commands;
  • Commands for studying system information;
  • Commands for using the registry;
  • System services management;
  • Reboot and shutdown systems from the command line;
  • Manage applications and processes from the command line.

Command Line Concept

Command line support is built into the Microsoft Windows operating system and is accessible through a command shell window. The Command Prompt is supported in all versions of Windows and is used to run built-in commands, utilities, and scripts. Despite the power and flexibility of the Command Prompt, some Windows administrators never use it. If you have enough graphical administration tools, you can only use them by clicking the user interface elements.

However, experienced Windows administrators, qualified technical support specialists and advanced users cannot do without the command line. Knowing how to properly use the command line—specifically, which command line tools to choose and how and when to use them so that they work effectively—can help you avoid many problems and ensure smooth execution of your operations. If you support multiple domains or networks, understanding time-saving ways to work with the command line is not only important but necessary to automate daily operations.

With each new version of Windows, the command line has been improved and its capabilities expanded. The command line has undergone significant changes, associated not only with increased productivity, but also with increased flexibility. Now you can use the Windows command line to solve problems that could not be solved in previous versions of Windows.

The Windows command shell environment is launched in different ways, in particular by specifying parameters when running Cmd.exe or using its own startup file stored in the directory %SystemRoot%\System32.

Additionally, the command line can be run in batch mode to execute a set of commands. In batch mode, the command line reads and executes commands one after another.

When working with the Windows command line, you need to understand where the commands you use come from. “Native” commands (built into the operating system) come in two types:

  • Domestic– exist inside the command shell, they do not have separate executable files;
  • External- implemented in separate executable files, which are usually stored in the %SystemRoot%\System32 directory.

Quick reference to shell commands (Cmd.exe)

  • assoc- displays or modifies mappings ( associations) file types;
  • break— sets breakpoints when debugging
  • call— calls a procedure or another script from a script;
  • cd (chdir) - shows the name of the current directory or changes the current directory;
  • cls— clears the command line window and screen buffer;
  • color— sets the text and background colors of the command shell window;
  • sorry— copies files or performs file concatenation;
  • date— shows or sets the current date;
  • del (erase) — deletes a specified file, group of files, or directory;
  • dir— shows a list of subdirectories and files in the current or specified directory;
  • echo— displays text in the command line window or sets whether commands should be displayed on the screen (on|off);
  • endlocal— marks the end of localization ( local scope) variables;
  • exit— exit the command line shell;
  • for— executes the given command for each file in the set;
  • ftype Lists or changes current file types in file extension mappings to programs;
  • goto— specifies that the command interpreter should go to the line with the given label in the batch script;
  • if— executes commands according to conditions;
  • md (mkdir)— creates a subdirectory in the current or specified directory;
  • move— Moves a file or group of files from the current or specified source directory to the specified directory. Can also rename a directory;
  • path— shows or sets the command path used by the operating system when searching for executable files and scripts;
  • pause— stops the execution of a batch file and waits for keyboard input;
  • popd— makes current the directory whose name was saved by the PUSHD command;
  • prompt— specifies what text should be shown in the invitation line;
  • pushd— saves the name of the current directory and, if necessary, makes the specified directory current;
  • rd (rmdir)— deletes a directory or a directory along with its subdirectories;
  • rem— marks comments in a batch script or Config.nt;
  • ren (rename)— Renames a file or group of files;
  • set— shows the current environment variables or sets temporary variables for the current command shell;
  • setlocal— marks the beginning of localization ( local scope) variables in batch scripts;
  • shift— shifts the position of replaced parameters in batch scripts;
  • start— launches a specified program or command in a separate window;
  • time— shows or sets the system time;
  • title— sets the title of the command shell window;
  • type— shows the contents of a text file;
  • verify— turns on the file verification mode after writing to disk;
  • vol— shows the label and serial number of the disk volume.

The syntax of any internal command ( and most external) can be obtained by entering the command name and /? at the command line, for example:

Command shell- a very powerful environment for working with commands and scripts. The command line allows you to run different types of commands: built-in commands, Windows utilities, and command-line versions of applications. Regardless of the type, every command you use must follow the same syntax rules. According to these rules, the command name is followed by required or optional arguments. Additionally, arguments can use input, output, or standard error redirection.

Sequence of events when executing a command

  • The command shell replaces any variables entered in the command text with their current values;
  • If a group or chain of several commands is entered, the line is split into individual commands, which in turn are split into the command name and arguments. Next, the commands are processed separately;
  • If a command name specifies a path, the shell looks for the command in that path. If there is no such command in the specified directory, the shell returns an error;
  • If the command name does not include a path, the shell first tries to resolve the command name internally. If an internal command with the same name is found, then an internal command has been called and can be executed immediately. If there is no internal command with the same name, the shell first looks for the command's executable file in the current directory, and then in the directories listed in the PATH environment variable. If the command file is not in any of these directories, the shell returns an error;
  • If the command is found, it is executed with the given arguments and, if necessary, input is read from the source specified in those arguments. Command output and errors are shown in the Command Prompt window or sent to a specified output and error sink.
  • As you can see, many factors affect command execution, including command paths, I/O redirection, and grouping or chaining of commands.

When working with a command shell, you probably started it by opening the Start menu ( Start) and selecting Programs ( Programs) or All Programs ( All programs), then Accessories ( Standard) and Command Prompt ( Command line). Other ways to start the command line are the Run dialog box ( Starting the program) or typing cmd in another, already open command shell window. These methods allow you to specify arguments when starting the command line: switches that control the operation of the command line, and parameters that initiate the execution of additional commands. For example, you can start a command shell in silent mode ( i.e. disable echo output) with the cmd /q command or to make the command shell execute the given command and exit - to do this, enter cmd /c, followed by the command text in quotes.

The following example starts a command shell, runs the ipconfig command, outputs the results to a file, and exits:

Cmd /c "ipconfig > c:\ipconfig.txt"

Creating Command Line Scripts

Command Line Scripts- text files with commands that you want to execute. These are the same commands that you typically enter in the Windows command shell. However, instead of typing commands every time you need them, you can script them and make your life easier.

Since scripts consist of standard text characters, they can be created and edited in any standard text editor, say Notepad ( notebook). When entering commands, be sure to start each command or group of commands that must be executed together on a new line. This will ensure they are executed correctly. When you've finished creating the command line script, save the script file with a .bat or .cmd extension. Both extensions work the same. For example, if you need to create a script to display the system name, Windows version, and IP configuration, include the following three commands in the SysInfo.bat or SysInfo.cmd file:

Hostname ver ipconfig -all

Controlling the display of text and commands

Team ECHO serves two purposes: to write text to output ( for example, to a command shell window or a text file) and to enable/disable command echo display. Typically, when you run script commands, the commands themselves and the output of those commands are displayed in a console window. This is called command echoing ( command echoing).

To use the ECHO command to display text, type echo followed by the text you want to display:

Echo The system host name Is: hostname

To control echoing of commands using ECHO, type echo off or echo on, for example:

Echo off echo The system host name is: hostname

To direct output to a file rather than to a shell window, use output redirection, for example:

Echo off echo The system host name is: > current.txt hostname » current.txt

Now let's see how command echoing is suppressed. Start a command shell, type echo off, then other commands. You will see that the command prompt is no longer displayed. Instead, only what is typed in the console window and the output of executed commands appears. In scripts, the ECHO OFF command disables command echoing and the command prompt. By adding the ECHO OFF command to your scripts, you prevent your shell window or file from being cluttered with command text if you are only interested in the output from those commands.

Studying system information

Often, when working with a user's computer or a remote server, there is a need to obtain basic information about the system, such as the name of the user registered in it, the current system time, or the location of a specific file. Commands that collect basic system information include:

  • NOW- displays the current system date and time in 24-hour format, for example Sal May 9 12:30:45 2003. Available only in Windows Server 2003 Resource Kit;
  • WHOAMI— reports the name of the user currently registered in the system, for example adatum\administrator;
  • WHERE— searches for files using a search pattern ( search pattern) and returns a list of matching results.

To use NOW or WHOAMI, simply type the command in the command shell window and press Enter. The most common syntax for WHERE looks like this:

Where /r base_directory_file_name

Here the /r parameter is specified for a recursive search starting from the specified directory (base_directory) and including all its subdirectories, and file_name is the full or partial name of the file being searched, which may include wildcards: the ? replaces one character, and the * sign replaces a group of characters, for example data???.txt or data*.*. The following example searches the C:\ directory and all its subdirectories for all text files whose names begin with data.

Where /r C:\data*.txt

You can also find files of all types whose names begin with data:

Where /r C:\data*.*

Sometimes you need to obtain information about the system configuration or the system environment. In mission-critical systems, this information can be saved or printed for reference. Listed below are commands that allow you to collect information about the system.

  • DRIVERQUERY— displays a list of all installed device drivers and their properties, including the module name, display name ( display name), driver type and build date ( driver link date). The all information display (/V) mode reports the status and state of the driver, startup mode, memory usage information, and file system path. The /V option also turns on detailed information about all unsigned drivers.
  • SYSTEMINFO- Provides detailed information about the system configuration, including information about the version, type and manufacturer of the operating system, processor, BIOS version, amount of memory, regional standards, time zone, and network adapter configuration.
  • NLSINFO- Displays detailed regional information, including default language ( default language), Windows code page, time and number display formats, time zone, and installed code pages. This command is only available in the Windows Server 2003 Resource Kit.

To use these commands on your local computer, simply type the name of the desired command in the command shell window and press Enter.

Commands for using the registry

The Windows Registry stores configuration information for the operating system, applications, users, and hardware. This data is contained in sections ( keys) and parameters ( values) registry, which are located in a specific root section ( root key), which controls how and when sections and parameters are used.

If you know the paths to the partitions and understand the allowed data types in the partitions, you can use the command REG to view sections and parameters and manipulate them in a variety of ways. REG supports several subcommands:

  • REG add— adds a new subsection or element to the registry;
  • REG delete— deletes a subsection or element from the registry;
  • REG query— displays a list of section elements and subsection names ( if they exist);
  • REG compare— compares subsections or registry elements;
  • REG I'm sorry— copies a registry element to the specified partition path on a local or remote system;
  • REG restore— writes previously saved subsections, elements and parameters to the registry;
  • REG save— saves a copy of the specified subkeys, elements and registry settings to a file.

System Services Management

Services provide key functionality for workstations and servers. To control system services on local and remote systems, use the service controller command ( service controller command) S.C., which has a set of subcommands, only part of them is described below:

  • SC config— setting up accounts for registering and running services;
  • SC query— displaying a list of all services configured on the computer;
  • SC qc— displaying the configuration of a specific service;
  • SC start— starting services;
  • SC stop— stopping services;
  • SC pause— suspension of services;
  • SC continue— resumption of services;
  • SC failure— specifying actions to be performed when a service fails;
  • SC qfailure- View actions taken when a service fails.

In all commands you can specify the name of the remote computer whose services you want to work with. To do this, insert the UNC name or IP address of the computer before the subcommand you are using. Here's the syntax:

Sc ServerName Subcommand

Reboot and shutdown systems from the command line

Systems often have to be rebooted or shut down. One way is to use the Shutdown utility for this, which allows you to work with local and remote systems. Another way to control system shutdown or reboot is to assign a shutdown task. Here you can use Schtasks to specify a shutdown time, or create a script with a list of shutdown commands for individual systems.

The following commands allow you to control the reboot and shutdown of the local system.

Shutting down the local system:

Shutdown /s /t Shutdown Delay /1 /f

Shutdown /r /t Shutdown Delay /1 /f

Application, process and performance management

Whenever the operating system or user starts a service, application, or command, Microsoft Windows starts one or more processes to manage the associated program. Several command line utilities will make it easier for you to monitor and manage programs. These utilities include:

  • Pmon (Process Resource Manager) - Shows performance statistics, including memory and CPU usage, and a list of all processes running on the local system. Allows you to receive detailed " pictures» resources involved and processes performed. Pmon comes with the Windows Resource Kit;
  • Tasklist (Task List) - lists all running processes by name and process ID, reports information about the user session and occupied memory;
  • Taskkill (Task Kill) - stops the execution of a process specified by name or identifier. Using filters, you can stop processes based on their state, session number, CPU time, memory usage, user name, and other parameters.

That's basically all I wanted to tell you about the basics of the Windows command line.

I want to tell you about all the command line commands that you may need when working with Windows OS. Please think carefully before using the suggested commands. Since their use by an unqualified person can lead to the fact that some information will be lost or computer equipment will malfunction.

Using the cmd command will allow you to launch a command line console. If you look at everything carefully, you can come to the conclusion that it is the ancestor of the well-known DOS system. At the same time, no matter how archaic and simple it may seem to modern users, in terms of speed and efficiency in performing specified functions, nothing can compare with it.

Please note:
If you have never encountered this before and do not understand how it all works, then it is better for you not to use them yourself. They will help set up a computer only for a specialist or qualified user. If you want to know how a particular command works, simply enter it in the command line, then press "Enter".

List of commands

A
ADDUSERS - Add or get a list of users from a CSV file
ADMODCMD - Change "Active Directories" in batch
ARPAddress - Address Determination Protocol
ASSOC - Changing file associations
ATTRIB - Change file attribute

B
BCDBOOT - Create or restore system partition
BOOTCFG - Change Windows boot settings
Browstat - Getting information about the main browsers of a domain

C
CACLS - Changing file permissions
CALL - Call one batch file from another.
CD - Go to a specific folder
CHANGE - Changing the terminal server session properties
CHKDSK - Checking and fixing errors
CHKNTFS - Checking the NTFS file system
CHOICE - Accept keyboard input into batch file
CIPHER - Encrypt or decrypt a file/folder
CLEANMGR - Automated cleaning of temporary files, recycle bin
CLEARMEM - Clear memory cache
CLIP - Copy STDIN to Windows Clipboard
CLSCLEAR - Clear screen
CLUSTER - Windows Clustering
CMDSTART - New CMD shell command
CMDKEY - Manage stored usernames/passwords
COLOR - Change color in the command window
COMP - Compare the contents of two files or a set of files
COMPACT - Compress files and folders on an NTFS partition
COMPRESS - Compress individual files onto an NTFS partition
CON2PRT - Connect or disconnect the printer
CONVERT - Convert a FAT partition to NTFS
COPY - Copy one or more files to another location (location)
CSCCMD - Client-side caching (for offline files)
CSVDE - Export and import connection agreement data

D
DATE - Display or set the date
DEFRAG - Defragment hard drive
DEL - Delete one or more files
DELPROF - Delete user profile
DELTREE - Delete a folder and all subfolders
DEVCON - Command line device manager
DIR - Display a list of files and folders
DIRUSE - Show disk space
DISKPART - Setting up storage device parameters
DNSSTAT - DNS Statistics
DOSKEY - Command line editing, command reminder and macro creation
DSACLS - Query security attributes and change permissions and security attributes of Active Directory objects
DSADD - Directory Service when performing Active Directory administration tasks
DSGET - Displays properties of directory objects
DSQUERY - Queries Active Directory for objects that meet the specified search conditions;
DSMOD - Modifies selected attributes of an existing directory object
DSMOVE - Moves an object from Active directory to a new location
DSRM - Deleting an object or the entire tree below the object in the hierarchy, or deleting both the object and the tree

E
ECHO - Display a message on the screen
ENDLOCAL - End of local environment changes for a batch file
ERASE - Deleting one or more files
EVENTCREATE - Add a message to the Windows event log
EXIT - Exit the current script/service and set the error level
EXPAND - Unpacking files
EXTRACT - Unpacking CAB files

F
FC - Compare two files and display the differences between them
FIND - Find a text string in a text file
FINDSTR - Find strings in a file
FOR /FLoop command - Run the specified command for each file in the set
FORLoop command - Run the specified command for all file parameters, directories, lists
FORFILES - Batch processing multiple files
FORMAT - Format disk
FREEDISK - Check free disk space (in bytes)
FSUTIL - File and partition utilities
FTP - File Transfer Protocol
FTYPE - Display or change the file type used when matching by file name extensions

G
GLOBAL - Show members of global groups
GOTO - Transfer control to the marked line of a batch file
GPUPDATE - Group Policy Settings Update

H
HELP - Display help information about commands
HOSTNAME - Computer host name

I
ICACLS - Change file and folder permission
IF - Conditional command execution statement in a batch file
IFMEMBER - Whether the current user is a member of a workgroup
IPCONFIG - IP Configuration

K
KILL - Terminate the process, terminate the program

L
LABEL - Change disk label
LOCAL - Show members of local groups
LOGEVENT - Entering text in Event Viewer (Event Log)
LOGMAN - Start and stop collecting log file data on a remote computer
LOGOFF - Logs a user out of a session and removes the session from the server
LOGTIME - Display the execution time of all operations in a log file

M
MAPISEND - Sending email using the command line
MEM - Show memory usage
MD - Create a new folder
MKLINK - Create a symbolic link
MODE - Configuring system devices
MORE - Serial output of data in parts the size of one screen
MOUNTVOL - Disk management, attaching a disk to a local disk folder
MOVE - Move files from one folder to another
MOVEUSER - Moving a user from one domain to another
MSG - Send message
MSIEXEC - Launching the Microsoft Windows Installer
MSINFO32 - System Information
MSTSC - Remote Desktop Connection
MV - Copying used files

N
NET - Network Resource Management
NETDOM - Domain Management
NETSH - Settings for network interfaces, Windows firewall and remote access
NETSVC - Service Controller Command Line
NBTSTAT - Show network statistics (NetBIOS over TCP/IP)
NETSTAT - Show network statistics (TCP/IP)
NOW - Display current date and time
NSLOOKUP - Search for server name
NTBACKUP - Backup folders to tape
NTRIGHTS - Change user account rights

O
OPENFILES - Query and display open files

P
PATH - Display or set the search path for executable files
PATHPING - Route tracing plus network delays and packet losses
PAUSE – Pause the execution of a batch file and display a message
PERMS - Show permissions to user
PERFMON - Opens the Performance console
PING - Checks network connection
POPD - Restore the previous value of the current active folder saved using the PUSHD command
PORTQRY - Displays the status of ports and services
POWERCFG - Configuring power settings
PRINT - Print a text file
PRINTBRM - Print Queue Backup/Restore
PRNCNFG - Display, configure or rename the printer
PRNMNGR - Add, remove, display printer list, set default printer
PROMPT - Change the prompt on the command line
PSEXEC - Execute a process remotely
PsFile - Show files opened remotely
PSGETSID - Displays the computer or user ID
PSINFO - Show system information
PSKILL - Kill a process by name or process ID
PSLIST - Show detailed information about processes
PSLOGGEDON - Show who is logged in (locally or via resource sharing)
PSLOGLIST - Event log entries
PSPASSWD - Change account password
PSSERVICE - View and manage services
PSSHUTDOWN - Shut down or restart your computer
PSSUSPEND - Suspend a process
PUSHD - Save the value of the current active folder and move to another active folder

Q
QGREP - Searches for a file or files in lines that match a given value.

R
RASDIAL - Managing Remote Access Service connections
RASPHONE - Managing Remote Access Service connections
RECOVER - Recovering damaged files from defective disks
REGREGISTRY - Making changes, reading, exporting, deleting keys and values ​​in the registry
REGEDIT Import or export registry settings Import and export registry settings
REGSVR32 - Register or unregister dynamic DLLs
REGINIChange - Permission to change the registry
REM - Putting comments in batch files
REN - Renaming files and folders
REPLACE - Replacing or updating one file with another
RD - Delete folder or folders
RMTSHARE - Share a folder or printer
ROBOCOPY - Copies file data for any file that is older, newer or changed
ROUTE - Managing routing tables on a network
RUNSTART – Running control commands
RUNAS - Running a program under a different user account
RUNDLL32 - Loading and executing a 32-bit DLL

S
SC - Interacting with the service controller from the command line
SCHTASKS - Controls the creation, deletion, settings, or display of assigned tasks.
SCLIST - Display services
SETDisplay - Install or remove environment changes
SETLOCAL - Start local environment changes for a batch file
SETX - Set environment changes permanently
SFC - System File Checker
SHARE - Show or change a shared directory or shared printer
SHIFT - Changing the contents of inline parameters for a batch file
SHORTCUT - Create a Windows shortcut (.LNK file)
SHOWGRPS - List of connected user workgroups
SHOWMBRS - List of users who are members of a workgroup
SHUTDOWN - Turn off the computer
SLEEP - Wait for x-seconds
SLMGR - Software Licensing Management (Vista/2008)
SOON - Schedule commands to be executed soon
SORT - Sort input
START - Launch a program or command in a separate window
SU - Change user
SUBINACL - Edit files and folders, own data and domain
SUBST - Associate a path with a drive letter
SYSTEMINFO - Show system configuration

T
TASKLIST - List of running applications and services
TASKKILL - Removing running processes in memory
TIME - Display and set the system time
TIMEOUT - Batch file processing delay
TITLE - Assigning a window title for the current session of the CMD.EXE command line interpreter
TLIST - List of tasks with full path
TOUCH - Changing the tag file
TRACERT - Tracing a route to a remote host
TREE - Graphical display of the folder structure of a given drive or folder
TSSHUTDN - Remotely shut down or restart the terminal server
TYPE - Display the contents of text files
TypePerf - Write performance data to the event log

U
USRSTAT - List of domain names and last login to one of them

V
VER - Display version information
VERIFY – Setting the mode for checking whether files are written to disk correctly
VOL - Show disc labels

W
WAITFOR - Waiting for or sending a signal
WHERE - Find and display files in a directory tree
WHOAMI - Display current username and domain
WINDIFF - Comparing the contents of two files or sets of files
WINMSDP - Windows System Report
WINRM - Windows Remote Management
WINRS - Window Remote Control Shell
WMIC - Window Management Instrumentation Commands
WUAUCLT - Windows Update

X
XCACLS - Changing permissions for files and folders
XCOPY - Copying files and folder trees

Using Windows CMD commands you can launch system utilities much faster than doing it the usual way.

And, although not everyone understands the meaning of this text interface, considering it outdated, in fact the tool is quite useful.

And not only for professionals, but also for ordinary users.

Although to run most commands (cmd) you should be running as administrator.

Content:

The need to use the command line

The cmd line, which is a standard platform tool, is no different in different versions of operating systems - the seventh, the eighth, the tenth, and even XP.

And all teams work the same way in each of them.

The advantage of using a line is that it speeds up the work - sometimes entering the desired command is much faster than searching for the corresponding file in the system folders.

Moreover, to speed up work with CMD, a link to it can be displayed on the desktop - or even on the Quick Launch panel.

The disadvantages of the interface are:

  • manual command entry from the keyboard;
  • the need to run CMD as an administrator (most commands will not run otherwise);
  • a fairly large list of commands that are difficult to remember.

Externally, the command line is largely reminiscent of the DOS system interface. And, although it allows you to solve many more problems, .

For example, “format”, “cd” and “dir”, necessary for working with folders and drives.

Working with the interface

Before you start working with the command line, you must first launch it. There are several ways to do this:

  1. Open the “Run” menu (pressing Win + R simultaneously) and enter the cmd.exe command;
  2. Go to the Windows folder on the system drive, open the System32 directory and run the file called cmd.exe. You can simplify the task by creating a shortcut that launches the same application and install it on the desktop;
  3. Open the "Start" menu, go to the "All Programs" section, then to the "Accessories" subsection and find the command line.

You should know: After the first launch through the Start menu, CMD appears at the top of it - in the list of most frequently launched applications and utilities. And you can open a line while working in any application (even in a game), just by pressing the Win button on the keyboard.

The standard view of the command line is a black window with white text. If this option does not suit the user, he can change the colors depending on his preferences.

To do this, right-click on the top of the window and go to CMD properties.

In the window that opens, you can select the location of the line, the colors of the text or window, and even the font sizes.

Here you can expand the interface to almost the entire screen, increasing the level of convenience of working with it.

Rice. 2. Change command line settings

Commands to help you work with CMD

They help make using the command line even easier - although they are not the same as the usual Windows shortcuts.

Instead of pressing the standard Ctrl + C and Ctrl + V typings, copying and pasting text is done as follows:

  1. Right-click on the selected line in the open CMD window;
  2. Select “Mark”;
  3. Select text using the left button;
  4. Right click again. After this, all information ends up in the operating system's clipboard.

In order to paste the copied information, press the same right button and select “Paste”.

You can simplify data copying by checking the box "Mouse selection" in command line properties.

After this, the text can be immediately selected with the left button. If you uncheck the quick paste box, the data is inserted on top of already written commands.

List of hotkeys

When working with the command line, use the following “hot keys”:

  • The up and down arrows allow you to move the cursor around the window, including commands that have already been entered;
  • Home and End move the cursor to the beginning and end of the line, respectively;
  • the left and right arrows together with the Ctrl key pressed simultaneously allow you to move the cursor in a given direction by an entire word;
  • Insert , as in any text editor, switches the modes of inserting text with a shift to the right and overwriting over written data;
  • Esc deletes the selected information;
  • F1 allows you to enter the last recorded command one character at a time;
  • F5 prints the previous command;
  • F7 lists the last few entries. By default, their number is 50.

Basic commands

The list of basic commands that most users need is relatively small and consists of commands that perform the following actions:

  • work with catalogs;
  • provide statistics on the operation of various applications, the network and the operating system as a whole;
  • restore driver functionality;
  • turn off the computer.

Using the command line, you can even format a disk (including the system disk, which cannot be formatted by any other means) and even stop the process.

Also, using CMD, the user gets access to the registry editor and the system configuration window much faster.

Working with catalogs

The main command for working with directories is dir. With its help you can check the contents of an open directory.

And if you need to open another folder, you should additionally specify the path to it. For example, select “dir C:\” or “dir D:\”.

Rice. 3. Checking the contents of logical drive C.

The second command for working with directories is cd. With its help you can go to any selected folder.

For example, by writing “cd C:\Windows” on the command line, go to the system directory.

To open a folder on a disk that is already selected, issue a command like “cd /D D:\”.

Rice. 4. Transition from local drive C to drive D.

The mkdir command creates a new folder. And the parameter that is set after it determines the name of the directory.

So, after entering “mkdir D:\New_Folder”, the corresponding directory appears on drive D.

If the user specifies several directories in the list at once (for example, “E:\New\Games\Fallout_3”), an entire tree of folders can be created.

Rice. 5. Create a new folder from the command line.

Running the rmdir command allows you to delete a directory by specifying its full path. For example, by writing "rmdir D:\New_Folder" you can erase the newly created folder.

Although, if there are other files inside the directory, a message appears on the screen indicating that it is not empty.

  • shutdown /s simply stops the operating system, closing all unfinished processes;
  • When you select the shutdown /s /t 3600 command, the timer will be set to exactly one hour. If you need to set any other time, the corresponding number of seconds is written instead of 3600;

Rice. 7. Enable automatic shutdown of the system.

  • To cancel an already set timer, enter the shutdown /a command.

Rice. 8. Cancel shutdown.

The commands work the same on any operating system. The only difference is in the inscriptions that appear.

Rice. 11. A utility that checks network operation.

The Netstat application shows information about active connections and statistics for various network protocols.

When you run the command without specifying specific parameters, only TCP connections are displayed.

Rice. 12. Checking active TCP connections.

The tasklist command displays a list of all processes running on the system. With its help, you can familiarize yourself with the data received from.

Although, if additional parameters are not specified, information is displayed only about the current device.

The ipconfig utility displays information about the IP address and .

Along with the command, additional parameters are used - for example, /all, which allows you to obtain information about each of the adapters.

Rice. 13. Obtaining information about network connections.

Changing system settings

The msconfig utility allows you to call up a menu that allows you to change the operating system configuration:

  • a list of programs that automatically load with the system;
  • launch options;
  • Windows boot options.

Most often, the command is used to remove or add an application to the startup tab.

And sometimes they make changes to the loading order of operating systems - if two of them are installed on the computer (for example, Windows XP, each of which may be more convenient for a particular user).

Rice. 14. Calling the menu for changing the system configuration.

Running the regedit utility allows you to open one of the most useful applications, with which you can get rid of the remnants of deleted programs, make changes to the operation of services and fix problems.

It is worth noting that changing any values ​​(not to mention deleting) must be done very carefully.

Errors in the registry can lead to system crashes and even reinstallation.



Related publications