Computer lessons

What to write on the Windows command line. Windows Command Line Commands

Hi all. In this article, we will talk about topics such as:

Command line (CMD) is a separate program that allows the user to directly interact with the operating system. Command line is based on an environment in which applications and utilities are executed using a text-based interface, and the execution result is displayed on the screen.

Command line Windows uses a command interpreter cmd.exe, which allows you to download applications and directs the flow of data between them, in other words, translates user commands into a form understandable to the system. Command line console integrated into all versions of Windows OS. At first sight command interface scares the user who is spoiled by the graphical interface of the same Windows, but as a rule command interface, is much faster and has a lot of additional features that cannot be implemented in a graphical interface.

Launch methods:

  1. Start / All Programs / Accessories / Command Prompt.
  2. Start / Run / enter cmd.exe in the line
  3. Run from the system folder: C:\WINDOWS\system32\cmd.exe

CMD commands.

Below I will give you a sign with a complete list command line commands, and after the tablet we will look in more detail at the main CMD commands.

Team Description
ASSOC Display or change associations based on file name extensions.
AT Execute commands and launch programs according to a schedule.
ATTRIB Display and change file attributes.
BREAK Enable/disable the CTRL+C key combination processing mode.
CACLS Display/edit access control lists (ACLs) for files.
CALL Calling one batch file from another.
CD
CHCP Display or set the active code page.
CHDIR Display the name or change the current folder.
CHKDSK Checking the disk and displaying statistics.
CHKNTFS Show or change whether disk check is performed during boot.
CLS Cleaning the screen.
CMD Launching another Windows command line interpreter.
COLOR Set the default text and background color.
COMP Comparing the contents of two files or two sets of files.
COMPACT Display/change file compression on NTFS partitions.
CONVERT Convert FAT disk volumes to NTFS. The currently active drive cannot be converted.
COPY Copy one or more files to another location.
DATE Display or set the current date.
DEL
DIR List files and subfolders from a specified folder.
DISKCOMP Comparing the contents of two floppy disks.
DISKCOPY Copying the contents of one floppy disk to another.
DOSKEY Editing and re-calling command lines; creating macros.
ECHO Display messages and switch the display mode of commands on the screen.
ENDLOCAL End of local environment changes for batch file.
ERASE Deleting one or more files.
EXIT Exiting the CMD.EXE (command line interpreter) program.
F.C. Compare two files or two sets of files and display the differences between them.
FIND Search for a text string in one or more files.
FINDSTR Searching for strings in files.
FOR Run the specified command for each of the files in the set.
FORMAT Formatting a disk for use with Windows.
FTYPE Display or change the file types used when matching by file name extensions.
GOTO Transfer control to the marked line of the batch file.
GRAFTABL Allows Windows to display extended characters in graphics mode.
HELP Displays help information about Windows commands.
IF An operator for conditionally executing commands in a batch file.
LABEL Create, change and delete volume labels for disks.
M.D. Creating a folder.
MKDIR Creating a folder.
MODE Configuring system devices.
MORE Sequential output of data in parts the size of one screen.
MOVE Move one or more files from one folder to another.
PATH Display or set the search path for executable files.
PAUSE Pauses the execution of a batch file and displays a message.
POPD Restores the previous value of the current active folder saved using the PUSHD command.
PRINT Printing the contents of text files.
PROMPT Changing the prompt in the Windows command line.
PUSHD Saves the current active folder and moves to another folder.
R.D. Deleting a folder.
RECOVER Recovering readable information from a bad or damaged disk.
R.E.M. Place comments in batch files and CONFIG.SYS file.
REN
RENAME Renaming files and folders.
REPLACE File replacement.
RMDIR Deleting a folder.
SET Listing, setting and removing Windows environment variables.
SETLOCAL Start local environment changes for the batch file.
SHIFT Changing the contents (shift) of substituted parameters for a batch file.
SORT Sorting input.
START Run a program or command in a separate window.
SUBST Matches the given path to a drive name.
TIME Displaying and setting the system time.
TITLE Assigns a window title for the current session of the CMD.EXE command line interpreter.
TREE Graphic display of the folder structure of a specified drive or specified folder.
TYPE Displaying the contents of text files.
VER Displays information about the Windows version.
VERIFY Setting the mode for checking the correctness of writing files to disk.
VOL Displays the volume label and serial number for the disk.
XCOPY Copying files and folder trees.

Command line commands.

Now let’s talk in more detail about the most frequently used commands, but first I’ll tell you a little about the keys that can be used together with commands for a more functional action. For example, let's take the RD command (remove directory), if it is applied to an empty folder, then it will be deleted, but if there are files in the folder, then nothing will happen. So, to delete a folder along with the files in it, you need to use the key together with the RD command /s.

That is, for example, there is a directory kat and to find any files in it, in order to delete the directory along with the files, you need to register RD/s cat. A list of keys to any command can be found by typing the command name followed by a slash and the question: command_name/?.

Basic commands for working with directories:

  • MD - Directory creation. Syntax: (MD directory name, it is possible to specify the location path).
  • RD - Removing a directory. Syntax: (RD directory name, it is possible to specify the location path). Note, RD without keys only allows you to delete an empty directory.
  • CD - Change the current directory. Syntax: (CD directory name, it is possible to specify the location path). CD\ - Go to the root directory. CD.. - Go to the parent directory.
  • DIR - View directory as a list. Syntax: (DIR directory name, it is possible to specify the location path).
  • TREE - Display directories in graphical representation. Syntax: (TREE directory name, it is possible to specify the location path).
  • MOVE - Move\Rename directory. Syntax: .
  • XCOPY - Copy directory structures. Syntax: (XCOPY what_we copy where_we copy, it is possible to specify the location path).

Commands for working with files:

  • COPY CON - Create a file. Syntax: (COPY CON file_name_with_extension, it is possible to specify the location path).
  • TYPE — Displays the contents of the file on the screen. Syntax: (TYPE file_name_with_extension, it is possible to specify the location path).
  • DEL - Delete a file. Syntax: (DEL file_name_with_extension, it is possible to specify the location path).
  • COPY - Copying a file\Combining files. Syntax(copy): (COPY what_we copy where_we copy, it is possible to specify the location path). Syntax(merging): (COPY file_name + file_name + file_name... merge_file_name, it is possible to specify the location path).
  • EDIT - Create\Edit a file. Syntax: (EDIT file name, it is possible to specify the location path).
  • MOVE - Move\Rename a file. Syntax: (MOVE what_we move where_we move, it is possible to specify the location path).
  • REN - Rename files. Syntax: (REN what_we rename what_we rename, it is possible to specify the location path).
  • FC - File comparison. (FC file_name file_name file_name..., it is possible to specify the location path).

System commands:

  • CLS - Screen cleaning.
  • DATE - View and display changes to the current date.
  • VER — Displays information about the current version of the Operating System.
  • VOL — Displays information about the volume-logical partition of the disk.
  • SYSTEMINFO - Display information about system configurations.
  • EXIT - Exits the command line.

These were the most used command line commands.

This is where I end this article, I hope you have fully understood the topics: CMD Commands, Command Line Commands, Command Line.

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 mode for checking files 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 create a script to do so 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 becoming 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. On 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 are);
  • 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 depending on their state, session number, CPU time, memory footprint, user name, and other parameters.

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

Windows for communicating with the computer in a language it understands. However, programs are still launched using the regular command line (console). It is the founder of the interface and a means of communication between the user and the PC. The essence of the work is that commands are entered into a line using the keyboard. This management method is often used by system administrators. Regular users should also know basic commands.

Console - what is it?

Windows programs are launched using the console - the command line. This is one of the types of text interface that has become available to many MS DOS users. Commands are entered into the command line manually. Many people consider the console to be an outdated management method, which is often needed by users and system specialists. The command line is a black window with a green location label and a blinking cursor. The corresponding command for the computer is entered into the specified location.

The Command Prompt is an incredibly convenient window for solving many problems. However, to interact with the console you will need knowledge of writing commands. The advantage is that they reduce the time required to complete complex actions. To do this, just enter the desired task in the line.

Why are teams needed?

Command line commands are necessary to establish user interaction with the operating system and computer. Working with the command line is an urgent need for specialists who are involved in system administration. The console is a small part of what you can use as a tool to work with Windows. The command line is convenient, fast, and can be used to easily solve many issues. Working with it will require knowledge of teams and skills that will lead to a positive result.

CMD - there are a huge number of commands. Practice will help you remember the main ones. Using commands, you can change, edit files, create, restore partitions, configure, run, restart the computer, delete folders, copy and much more. Experts advise making a list of important commands in alphabetical order in a notepad. It's convenient and helps you quickly find your way around.

How to start?

Windows command line commands run without much difficulty. Despite the graphical interface, the console has always been and is the main element of computer control. The basics of working with the console will be useful to the average user. To launch the command line, open the menu: “Start” - “Run”. Enter the word “Cmd” in the window that appears, press “Enter”. If the version of the operating system does not have the “Run” item, then the combination “Win ​​+ R”.

In Windows 7, right-click on “Start”, go to “Properties” - “Customize”, check the box next to “Run”. If you need to open the console as an administrator, enter the command “Cmd” in the “Start” search bar, right-click on the “Cmd” program, select “Run as administrator.” It is convenient to create a shortcut on the desktop that will open the console. The appearance of the line window can be changed according to the user's wishes (color, font, location).

Sometimes you may have problems copying and pasting text into the command line. In the case of the console, the clipboard buttons do not work. If you need to make a copy, right-click on the window, select "Mark", select the text with the left mouse button, and then right-click. To insert text or text, right-click the Paste command line window. In addition, you can work with the console using hot keys on the keyboard and the up/down arrows.

Basic

The main commands for the command line help the user to solve tasks of paramount importance in a short time.

Additional

The list of commands, which is auxiliary, is often used by system specialists to work with information located on the hard drive.

  • The “Format” command deletes data from the hard drive and prepares it for copying. As an example of a formatting command: “FORMAT disk:/FS:FAT (file system).”
  • The "FC" command compares files with each other.
  • “IPCONFIG” - shows complete information about the Network settings, and also reports the type of network connection “IPCONFIG/ALL”.
  • The PING command will check the site's availability. Example: “PING fb.ru”. The presence of numbers in the response indicates that everything is in order and the site is available for visiting.

Commands for the Network

Web command line commands let you surf the Internet efficiently, fix errors, and configure settings. If you need to find out your IP address, enter the “Ipconfig” command in the console. In different variations of Internet connection, you can find out complete information about the Network. After entering, the user will receive a list of network connections that are used by the computer. If the user's computer is connected to the Internet via Wi-Fi, the main gateway will be selected to communicate with the router. The user can access its settings through a command entered into the console. If the computer is connected to a local network, you can find out about the IP address through the command line with the corresponding request.

Using the “Ping” and “Tracert” commands, the user can quickly find and fix problems with the Internet and browser. The "Netstat-an" command displays network connections and ports. This is a very useful program because it displays various network statistics. The "-an" switch opens a list of available network connections, ports and IP addresses. The “Telnet” command connects to servers of the same name. If you need to get information about network settings, use the "Ipconfig" command. Without additional parameters, the command displays information about the IP address. If you need specific information, add the “All” command. Entering “Ipconfig/flushdns” into the line clears the cache in Windows.

Filters

Filters are command line commands that are used with the pipe redirection symbol. They are needed to sort, view and select information from other teams. Filters organize, divide, and highlight part of the information that passes through them. Among these commands are the following:

  • “More” - displays the contents of the file;
  • “Find” - searches for specified characters;
  • “Sort” - sorts files alphabetically.

In order to send data from a file, the “L” symbol is used, and the “I” channel is used to send data to the output.

Shutdown

In addition to the built-in CMD, the console is used to launch ordinary programs. In order to enter it, just type the desired combination of letters in the “Run” window. If you need to view the results, it is better to use a string. “SHUTDOWN” is a command that shuts down Windows if for some reason the Start button does not work. It is useful when the computer is performing a task that cannot be interrupted (and the user needs to leave and not leave the computer on for a long time). The device will turn off correctly upon completion of work on its own. It's better than setting a timer.

Type the following command “Shutdown-s-t-1300”, press “Enter”. The numbers are the time in seconds after which the device will turn off. The command to restart the computer from the command line is as follows: "Shutdown -r". Click "Confirm" to activate. “At” command - starts the PC at the time specified by the user. This utility reads and groups jobs in the Windows operating system.

Formatting

The list of commands for the console is huge. Many of them are harmless and simple, but there are special ones among them that require caution on the part of the user. Be careful! Sometimes it is necessary to completely format a disk or flash drive. The command to delete all data looks like this: “Format C”, auxiliary parameters “/fs” - determine the location of the file system of the formatting disk, “/v” - sets the volume label, “/a” - the cluster size. Do not execute the formatting command if you are not sure of your actions and do not know why it is needed. The command deletes all information from the PC!

Examination

Some command line commands are designed to check disks for system errors. The “CHKDSK” command without additional parameters displays information about the status of the hard drive. If errors are found, enter an additional “/f” to correct them. Before checking the drive, lock it. If the console is full of commands, enter “c/s” into the line to clear the screen.

The system files will be checked by the “Sfc” command. With its help you can recover damaged files. The command is supplemented with the parameters “/scannow”, “/scanonce”, “/scanboot”, which check and correct system errors in files.

Other

It is impossible to know all the commands on the line, but some of them will be useful to the user. For example, the "Assoc" command changes the association between extension and file type. If the user wants to find out detailed information about the operating system and the state of the computer, he should type “Systeminfo”. Using the system registry editor "Regent" you can change hidden OS settings. However, if you don’t know what’s what, it’s not recommended to do this due to the risk of breaking Windows. It is easy to call the system configuration - a special service by entering "Msconfic" into the command line. If you want to learn more about the commands, write “Help” in the console line, taking into account that the operating system is the seventh or eighth version of Windows.

Experts include network, system and filters as useful commands for the user. The "At" command consists of a whole set of commands that are used to install, reinstall, and configure the modem. It is also considered a team planner. With its help, you can change, cancel, configure tasks for a remote or local computer. In the Windows operating system, it is better to use the "SCHTASKS" utility instead of the "At" command. Its capabilities are much wider.

The most common startup recommendations are: Start, run, cmd. There is a Run option in the start menu. It runs a program that allows you to send single commands to the Windows system. In this case, the cmd command launches the cmd.exe executable file located in the system32 folder.

C:\WINDOWS\system32\cmd.exe

On some versions of Windows, the Run menu item is removed by default. In this case, press + R, enter cmd, then Enter. You can also launch the command line directly from the system32 folder by making a shortcut to launch it on the desktop (right-click on cmd.exe and select Send/Desktop from the menu) or through the task manager (new task button - cmd).

By default, you cannot use the mouse in the command line (move the cursor or select text). This is inconvenient in general and for beginners in particular. In addition, the black screen looks somehow too gloomy and dull. So after running the command line

you will need to change its settings. Right-click on the cmd window and select defaults. It’s worth noting right away that the default settings apply to cmd.exe as a whole, and the properties apply to a specific open window.

In the command line properties window that appears, we see four tabs:

On the Options tab, it is worth checking the items to discard repetitions (to reduce the filling of the command buffer) and mouse selection (so that you can use the mouse in your work).

On the Fonts and Colors tabs, everything is simple: select the size, type and color of the font, as well as the background color of the window. I will only note that the font size affects the size of the command line window, so it should be set before the window size, and not after.

In the Arrangement tab, you set the size of the window and its initial location at startup. I still don’t fully understand in what units the quantities are presented, so I advise you to set the size, guided by the preview window on the left.

It is worth noting that the buffer size affects the window capacity, i.e. on the amount of information that can be viewed without problems after the command execution results are displayed on the screen (horizontal and vertical scroll bars). If you set equal sizes for the window and the buffer, then the window will display only the tail of the output information that will fit there.

Also, if the line does not fit into the width of the window, this will lead to its wrapping. It is less convenient to perceive information presented in this way. Therefore, I always set the buffer much larger than the window size. This allows you to view large amounts of information using the scroll bars on the right and bottom. The image below is clickable. The preview shows the beginning of the output of the dir command for the system32 folder, and by clicking on the preview you can see the tail of the output (pay attention to the scroll bar on the right - there is a lot of data).

Command Line Commands

The console is configured, now it remains to familiarize you with the command line commands. To display a complete list of them, just type the help command.

help - displays help for the commands help CD or CD /? - display help for one command (for the CD command) cd - go to the root directory cd .. - go to the parent directory D: - go to drive D. dir - output all contents of the folder dir *.exe - output a list of exe files in the folder cls - clear the command line screen

Command Prompt remembers the commands you enter. You can scroll through them using the ⇑ and ⇓ keys. You can view the contents of a folder using the Tab key (Shift + Tab scrolls in reverse order). You can scroll through files to a specific letter or letters. For example, by typing the letter s and pressing Tab, you can scroll through only files and folders starting with this letter ( s system, s ystem32, s ystem.ini, etc.) . How this can be used:

For example, you need to go from the root of drive C to the system32 folder, find and launch the control panel in it. You can simply type:

C:\ windows\system32\control.exe

But this is not always fast and convenient, and besides, you don’t always know what exactly you need to type. Therefore, you can type the command CD, then after the space type wi Windows, put a slash after it, type the letters sy, scroll with the Tab key to the folder sy stem32, then slash again and the same with control.exe.

C: cd wi ndows\ sy stem32\ co ntrol.exe

This tab method is much faster in most cases than simple typing, since file and folder names can be long.

When you enable mouse support, you can copy information from the command line by selecting a section of text with the mouse and pressing Enter. The right mouse button, on the other hand, pastes information from the clipboard into the command line.

To conclude this article, I will say that cmd.exe is just an input/output program, the same as notepad. Of course, there are more advanced analogues that can also be used. One such program is Console Portable

By the way, in the GNU Linux operating system the command line can be called directly from the folder. In this case, a line will open immediately with the folder address and you will not need to enter it manually. In Windows, in order to open the command line directly in a folder, you need to hold down Shift, press the right mouse button and select "Open command window" from the menu.

You can also add this feature (and a number of others) using the FileMenu Tools context menu extension program:

Most personal computer users do not encounter the need to use any CMD command. Many people simply lack the functions provided by the visual shell of the operating system. However, there are situations when you have to manipulate the system directly, and that’s when the command line comes to the rescue.

What is the command line

This is software that is part of the standard programs of the system. CMD provides the user with the ability to work with the system and files directly. The application has a text interface, and the execution result is displayed on the screen. Simply put, the command line translates user requests into a form that the system can understand. Outwardly, of course, the program does not look very familiar to the average user, but at the same time it has a number of positive properties, and besides, it is faster than the visual component. built into every version of the Windows operating system.

Ways to launch the command line

The operating system developers have provided several options for launching CMD:

  • Go to the Start menu / Accessories / then select “Command Prompt” from the list.
  • Go to the Start menu, select "Run", in the window that appears, enter CMD.exe in the line. You can also open the Run window using the Win+R key combination.
  • Go to the system folder C:\Windows\system32 and select the CMD.exe program.

Most of the most important commands can be obtained using the Help command. After entering this request, Windows CMD commands will appear with information about how to use them. All of them can be divided into several fairly broad groups. Their division occurs according to the principle of application. For example, CMD commands to run the commands used. The most common of them will be presented below. They are also the most necessary CMD line commands.

Basic commands for working with system directories

This list of commands will be useful if you need to access folders located on the system:

  • Dir - provides the ability to view folders as a list. Using additional command line criteria, you can sort directories based on a number of options.
  • RD - provides the ability to delete an unnecessary directory. With additional parameters, you can set deletion criteria: for example, delete several folders at once.
  • MD - the command creates a new folder (directory). Various options allow you to create different types of directories.
  • CD - provides the ability to move from one directory to another, in some cases you will need to use quotes.
  • XCopy - used to copy folders without changing their structure. Unlike Copy, this one has more advanced command capabilities. Via CMD, you can perform fairly flexible operations with this request.
  • Tree - provides the ability to display directories graphically. By default, the display is done using pseudographics.
  • Move - used to both move and change the directory name. The command makes it possible to move several folders at a time.

Basic commands for working with files

These CMD file commands can be useful to many personal computer users:

  • del - command used to delete. Can be used to delete one or several files. In addition, there is an option to delete read-only files;
  • edit - the command launches a text editor;
  • ren - allows you to rename a file. You can also use rename;
  • move - used to move and rename a file;
  • copy con - allows you to create a new file;
  • fc - allows you to compare what is in two files. The result of the work is the appearance of symbols that provide information about the status of the comparison;
  • type - applicable for text documents. The execution of the command is to display the contents of the file on the screen;
  • copy - allows you to copy and also merge files.

Commands for diagnosing the hard drive of the computer and system

In addition to all the above advantages, CMD commands allow you to check for errors in the operation of hard drives or change volume labels, as well as defragmentation.

  • Compact - the command allows you to display and configure compression in the NTFS file system. Using this command you can significantly save disk space.
  • Format - formats a disk or floppy disk. Please note that formatting will completely delete all data on the media.
  • Chkdisk - checks and displays information about the media. The team will help you find out about the occupied space, the amount of space on bad sectors, and so on.
  • Fsutil - provides information about the file system and allows you to make changes to it.
  • Chkntfs - allows you to show and configure during Windows startup.
  • Convert - allows you to convert a volume from one file system to another. It is not possible to change the type of the active volume or disk.
  • Recover - a command for recovering data from damaged media. This process occurs by reading one sector after another. Reading occurs only from those sectors from which it is possible to read. Data located in physically damaged sectors will not be recovered. Most often, text documents are recovered from damaged floppy disks in this way.
  • Diskpart - allows you to open disk data and make the required settings.
  • Vol - provides information about the serial number of the hard drive.
  • Label - used to view and edit volume labels. Please note that the volume name can contain no more than 11 characters, and NTFS 32 characters.

Information commands

This type of command will help you obtain information about versions, configurations, and installed drivers:

  • ver - provides information about the system version using the CMD command, Windows 7 also supports this request;
  • driverquery - allows you to view information about installed drivers; The display can be in the form of a list, table or CSV;
  • systeminfo - Provides information about system configurations. Configurations can be viewed both locally and in addition, the command provides properties about service packs.

processes and applications

Commands for managing and changing operating system settings:

  • shutdown - the command is used to shut down, restart or put the computer into sleep mode. If the user has the necessary rights, it is possible to carry out settings remotely;
  • time - used to display and change the current time;
  • date - used to display and change the current date;
  • tasklist - provides the user with a list of processes currently running on a local or remote personal computer;
  • schtasks - allows you to create, configure or delete scheduled tasks in the operating system. In the graphical interface, the command is represented by the Task Scheduler program;
  • taskkill - used to terminate processes using identifiers or names of executable files. The tool began to be used with Windows XP.

Commands to customize the command line

This group of commands relates directly to setting up the CMD. The commands will help you clear the screen, change its appearance, and so on:

  • Exit - allows you to close batch data or close the command line altogether.
  • Color - provides the ability to change the background or font color in the command line window. The color is specified as a hexadecimal digit. The most significant bit indicates brightness, and the subsequent bits indicate color. The default is white letters on a black background.
  • Title - allows you to change the name of the CMD.exe window.
  • CMD - allows you to open a new Windows command line interpreter window. Usually the need for this command occurs when you want to predefine the actual CMD settings.
  • Prompt - allows you to change the command line greeting. If you use the command without parameters, the prompt text will look like: current drive, directory and the greater-than symbol.

Network CMD commands

Most users rarely need these queries, but professionals believe that these codes are very helpful when working with a computer:

  • getmac - the command provides information about the hardware addresses of network adapters. In this case, you can find out both local and remote addresses;
  • netsh.exe - the command opens another line. Using it, you can configure the network if necessary. Many experienced users find this program indispensable. To get help about commands, you must write it with a question mark;
  • ipconfig - allows you to obtain information about protocol settings. Sometimes the command allows you to update data automatically. Older operating systems may not support this CMD command;
  • nbtstat - the main purpose of the command is to display NetBt information. in addition, names and contents are displayed;
  • netstat.exe - This command displays information about connections. The output data allows you to see all the information related to

It is worth remembering that, in addition to these network commands, there are some more that will help simplify the work of users. It should be remembered that these commands should only be used when you are confident in the action being performed. Improper use of CMD commands can lead to serious problems in the operation of your personal computer.

List of useful commands

In addition to the above commands, there are a huge number of others:

  • break - the command allows you to enable processing of the CTRL+C keys;
  • debug - launches a tool for debugging and other changes to software products;
  • devcon - the command launches a tool alternative to the task manager;
  • exe2bin - the command converts exe format applications to binary format;
  • hostname - provides the ability to obtain the computer name;
  • logoff - the command shuts down the Windows system.

All of the CMD commands given will make it easier to work with some software. The main thing is not to try to use requests for purposes other than their intended purpose, in order to avoid loss of important information and other undesirable consequences.