Windows.  Viruses.  Notebooks.  Internet.  office.  Utilities.  Drivers

Today we will talk about the command line, namely the commands that will be useful to use. The interface itself command line, as we know, is not very pleasing to the eye, however, with it we can use the most necessary commands that do not have graphic shell. So, command line commands. By the way, instead of the standard Windows console, you can use a more functional .

Driverquery

This utility allows you to solve some problems with . Many users, in order to find out any information about drivers, use third party applications, V this case this is not necessary and you can use the built-in utility.

To run this program, enter the command:

or

Check Disk - CHKDSK

As is already clear from the title of the item, the command line utility allows you to hard drive as well as fix file system errors.

To run the utility, you need to type the following command at the command line:

chkdsk C:/F / R

WITH: is the letter of the drive to be checked.

/F- a function that activates a disk check for errors.

/R– searches for bad sectors.

IPConfig

This utility allows users to find out the IP address of their computers and information about TCP / IP connections, as well as, network adapters, modems, etc.

Also, with some additional features, you can use this command to clear the DNS cache and update IP addresses for some devices, such as a network adapter.

To run the IPCONFIG utility, you need to enter the command at the command line:

To clear the DNS cache, enter this command:

These are the basic commands that exist on the Windows command line. Of course, they are not the only ones and there are many of them. We already have an article where almost all commands and short description to them, . That's all. Also read about. Suddenly it will be interesting.

In Windows 7, there are some operations that are impossible or difficult to perform through the normal GUI, but they can actually be implemented through the "Command Line" interface using the CMD.EXE interpreter. Consider the main commands that users can use when using this tool.

With the help of commands in the "Command line" various utilities are launched and certain operations are performed. Often, the main command expression is used along with a number of attributes, which are written through 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, one would have to write more than one article. We will try to fit on one page information about the most useful and popular command expressions, 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- starts the Check Disk utility, which executes . 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– disable the specified hard drive;
  • /scan– proactive scanning;
  • C:, D:, E: …— specifying logical drives for scanning;
  • /? – call for help about the operation of the Check Disk utility.

SFC– launching the utility. This command expression is most commonly used with the attribute /scannow. It launches a tool that checks OS files against 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 desired directory. A prerequisite is to specify the path to the folder to which the action will be applied. The entry is made according to the following pattern:

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

The following attributes can be applied when using this command:

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

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

  • h- hidden;
  • s- system;
  • r- only for reading;
  • a- archival.

In order to apply or disable an attribute, the sign is placed before the key, respectively. «+» or «-» .

COPY- used to copy files and directories from one directory to another. When using the command, it is obligatory to specify the full path of the copy object and the folder to 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 of the target object in case of a coincidence of names without confirmation;
  • /? Help activation.

DEL– deleting files from the specified directory. The command expression provides for the possibility of using a number of attributes:

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

RD- is an analogue of 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 applied along with the main expression:

  • /q– obtaining information about the owner of the file;
  • /s– displaying the 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- to size);
  • /d– displaying the list in several columns with sorting by these columns;
  • /b– display only file names;
  • /a– display of objects with certain attributes, for which the same keys are used 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

MD– designed to create a new folder. In the command syntax, be sure to 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, 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 argument of this command is the full path to the object, the text of which should be viewed. For example, to view the contents of the file.txt file located in the folder Folder on disk D, you need to enter the following command expression:

TYPE D:\folder\file.txt

PRINT- print content text file. The syntax of this command is similar to the previous one, but instead of displaying the text on the screen, it is printed out.

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

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

Working with accounts

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

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

TSCON- Attaches a user session to a terminal session. When using this command, you must specify the session ID or name, as well as the password of the user to whom it belongs. The password must 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 on running processes on the PC. Among the output information will be the name of the process, the name of the user who launched it, the name of the session, ID and PID.

TASKKILL– used to terminate processes. The required argument is the name of the element to be stopped. It is specified 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 control various actions on the network.

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

NETSH– initiates the launch of the utility of the same name, with the help of which information about the network parameters is displayed and changed. This command, due to its very wide functionality, has a huge number of attributes, each of which is responsible for performing a specific task. For detailed information about them, you can use the help by using the following command expression:

NETSTAT– display 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– view and set 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 on the very bottom line.

DATE- the command is completely similar in syntax to the previous one, but is used not to display and change the time, but to start these procedures with respect to the date.

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

BREAK- disable or start the processing mode of a combination of buttons 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 of them, for convenience, dividing them into groups according to purpose.

What is command line

Majority computer users know little about the command line. While more experienced and advanced users quite often use it to perform various tasks.

Very often, the command line is used by administrators to perform the same type and routine tasks, when administering servers and other things.
The command line has been in Windows since the days of MS-DOS and allows users to directly interact with the Windows operating system.

The command line or, as it is called the console, looks unremarkable and to interact with the operating system, you need to enter commands, observing a certain syntax.

That is why it is used to create batch files (BAT-files) that perform a certain sequence of operations to perform a given task.

What are the benefits of using the command line

As already noted, the command line is used mainly by advanced users and administrators. With its help, the user can automate the execution of certain tasks of the same type.

That is, if you need to copy or rename files under certain conditions, then this is easily organized by creating special batch files that contain command line commands. Moreover, such operations will be performed without user intervention.

The advantage of the command line is easy to see if you need to perform the same type of operation on a large number of files. For example, you need to move or copy (or delete) certain types of files to a particular location.

Administrators use the command line to get the necessary information about the work network devices and can judge possible reasons malfunctions and failures. Network administrators will be able to obtain information about network activity and its health.

How to open command prompt

To open a command prompt window, just open the Start menu and type Command Prompt in the search bar, then double-click on the corresponding result.

You can also just go to the All Programs section and in the Accessories folder and there will be a command line shortcut. Finally, you can use the Run utility by pressing the Win + R key combination or launch the Run utility from the Start menu. Now type in the Open cmd line and press Enter.

Myself executable file command line is located at system drive to the following path: Windows/System32/cmd.exe.

Customizing the command line window

The standard command prompt window is presented as a black background with white font. However, this is not convenient for everyone, especially if the user often resorts to the command line. Settings like appearance, and other additional command line settings will allow you to work more comfortably with the console.

To do this, just click on the window icon in its left part with the left mouse button (or press Alt + Space). A context menu will appear where, by selecting Properties, you can make basic settings for the appearance, mouse cursor, size and location of the window.

Options such as Mouse Selection will allow you to copy the selected command line text, the number of buffers determines how many lines on the command line will be available for viewing by the user. The buffer size allows the user to scroll through previously typed commands using the Up or Down Arrow keys.

Command line commands available to users

The command line has many commands, the list of which you can get in the command line itself. To do this, just enter the HELP command and the screen will display a complete list of commands with explanations:

ASSOC Screen display or modification of file name extension mappings.
ATTRIB View and modify file attributes.
BREAK Enables or disables the ability to use CTRL+C on a DOS system.
BCDEDIT Sets properties in the boot database that allow you to control the bootstrap.
CACLS Displays data and modifies file access control lists (ACLs).
CALL Calls one batch file from another and can also pass input arguments.
CD Displays the pathname or moves to another folder.
CHCP Output or set encoding.
CHDIR Displays the title or moves to another folder.
CHKDSK Diagnostics of the drive for errors.
CHKNTFS Shows or changes the drive diagnostics during boot.
CLSO cleaning the display of all characters.
cmd Runs a command line program Windows strings. You can run an infinite number of them on one computer. They will work independently of each other.
COLOR Changes and sets the main background of the window and the fonts themselves.
COMP Shows the differences and compares the contents of two files.
COMPACT Changes and shows file compression in NTFS.
CONVERT Changes FAT disk volumes to NTFS. The current drive cannot be changed.
COPY Creates a copy of a file or files and places them in the specified location.
DATE Shows or sets the current date.
DEL Destroys one or more files at once.
DIR Shows the names of files and folders with their creation date, located in the current folder or specified in the folder options.
DISKCOMP Compares and shows the differences between 2 floppy drives.
DISKCOPY Creates a copy of the contents of one floppy drive to another.
DISKPART Shows and changes the properties of a disk partition.
DOSKEY Modifies and re-invokes command lines; creates macros.
DRIVERQUERY Displays information about the "state of affairs" and attributes of the device driver.
ECHO Displays textual information and changes the display mode of commands on the screen.
ENDLOCAL Ends environment localization for a batch file.
ERASE Destroys a file or files.
EXIT Terminates a command line program
FC Shows differences between two files or two sets of files and compares them
FIND Searches for a text string in files or in a single file.
FINDSTR Advanced search for text strings in files.
FOR Cycle. Repeats the execution of the same command the specified number of times
FORMAT Formatting the drive for Windows.
FSUTIL Displays and sets file system attributes.
FTYPE Provides the ability to edit and view file types, which are primarily used in file name extension matching.
GOTO Transfers control to another specified command.
GPRESULT Displays information about group policy for a computer or user.
GRAFTABL Allows Windows to display the extended character set in graphics mode.
HELP Displays all data about existing Windows console commands.
ICACLS Shows, modifies, archives or restores ACLs for files and folders.
IF Executes commands based on a given condition.
LABEL Creates, modifies, and destroys volume labels for drives.
MD Creates an empty directory.
MKDIR Creates an empty directory.
MKLINK Creates symbolic and hard links
MODE Configures system devices.
MORE Sequentially displays information in blocks of one screen size.
MOVE Moves files from one location to another.
OPENFILES Shows files that are open on shared folder remote user.
PATH Displays or sets the full path to executable files.
PAUSE Terminates the execution of command line commands and prints informative text.
POPD Restores the previous active folder value that was saved using the PUSHD command.
PRINT Prints the contents of a text file.
PROMPT Modifies the prompt on the Windows command line.
PUSHD Saves the active folder value and navigates to another folder.
RD Deletes a folder.
RECOVER Resurrects readable data from a bad or damaged hard drive.
REM Places comments in batch files and the CONFIG.SYS file.
REN Changes the name of both files and folders.
RENAME Similar to the REN command.
REPLACE Swaps files.
RMDIR Destroys a directory.
ROBOCOPY Advanced tool for copying files and entire folders
SET Shows, sets, and destroys Windows environment variables.
SETLOCAL Localizes environment changes in a batch file.
SC Allows you to work with services
SCHTASKS Allows you to run any program and sequentially execute the necessary commands according to a given plan
SHIFT Changes the position (shift) of the inline parameters for the batch file.
SHUTDOWN Shuts down the computer.
SORT Sorts the input according to the given parameters.
START Launches a program or command in a new window.
SUBST Purpose given path drive name.
SYSTEMINFO Displays information about the operating system and configuration of the computer.
TASKLIST Shows a list of all running processes with their IDs.
TASKKILL Terminates a process or application.
TIME Sets and displays the system time.
TITLE Sets the name of the window for the current session of the CMD.EXE command line interpreter
TREE Displays the directories of the drive in a convenient visual form.
TYPE Displays the contents of text files.
VER Displays brief information about Windows versions.
VERIFY Checks for file write errors on the drive.
VOL Displays labels and serial number drive volumes.
XCOPY Creates a copy of files.
WMIC Displays WMI on the command line.

For novice users, knowing the command names is too little. According to the above list, you can only evaluate the capabilities of the command line. To use a particular command, you must follow the syntax for writing commands. You can again find out the syntax for any command using the command line itself. To do this, enter the command and after its name add /? and press Enter. The command HELP COMMAND_NAME will give the same result. For example:
COPY /? or HELP COPY

As a result, you will get a detailed syntax of the specified command with an explanation of all arguments.

In order not to repeatedly type the same command with different arguments, use the UP-DOWN arrow keys on the keyboard. Thus, the window will display previous commands entered into the console.

When working with the command line, many note that the usual key combinations for copying and pasting do not work, and this is true. To copy the selected text and then paste it, you must use the context menu called by pressing Alt+Space.

After that, you need to go to the Edit section. Further, if mouse selection is not enabled in the settings, select the Mark and select the desired fragment of the console text. Then again go to the context menu and in the Edit section select Copy, or just press Enter, and to paste into context menu select Paste.

Create command line batch files

Batch files are files with multiple lines of commands that will be executed sequentially automatically. Batch files are convenient to use for performing routine and similar tasks.

To create such a file, you need to text editor Notepad write one or more commands, following the syntax of the command line. After saving the file, you need to change its extension from TXT to BAT.

After running such a file, automatic execution commands written in it. In this case, a command prompt window will appear while the commands are being executed.

None dialog boxes or the results of the execution of the command are not displayed to the user, except for those provided by some commands.
An example of a simple batch file:
DEL C:Temp /Q
PAUSE

This file will clear the temporary Temp folder, located in the root of drive C. Moreover, a request to delete files will not be displayed (switch / Q). The PAUSE command here will allow you not to close the command prompt window after cleaning up the folder. That is, the user will be able to see the result of cleaning the temporary folder. After pressing any key, the command prompt window will be closed.
The PAUSE command is very often used specifically for debugging various scripts and checking the operation of batch files.

To exit the command line, simply close the window with the mouse or enter the EXIT command into the console.

Until the moment when operating systems learned to “communicate” with users using graphic images that are familiar to us, the input and output of information into a computer was carried out exclusively using text.

Of course, there are still operating systems that use the so-called interface to communicate with users. command line. But they are usually used by professional programmers, system administrators and other employees of the IT industry. For ordinary users manufacturers operating systems created a convenient graphical interface that allows you to “communicate” with a computer or, say, a smartphone using a mouse or pressing buttons on the screen.

Despite this, every operating system (including Windows XP, 7, 8, and so on) still supports input and output of information through text commands. The Windows command line is a clear example of this. Let's figure out what it is.

What is command line

First of all, it is a program cmd.exe, located in the system32 directory of the operating system folder. Location options: C:\Windows\system32\cmd.exe. The path may differ depending on the version of Windows and where it is installed.

In general terms, the command line is operating system tool, which usually consists of an OS shell and a text interface. The shell provides the user with the tools to " communication» with the operating system, which, in this case, are text commands.

Command line operating Windows systems, starting with XP, is designed to provide users with the ability to use MS-DOS and many other computer commands. Its important feature is that it is capable of performing custom commands without the help of a GUI. The need to understand and know all these commands makes it difficult for ordinary users to use the command line to control the operating system. However, it is not so difficult as it seems at first glance.

By understanding the basic principles of the command line, any user who is more or less familiar with the computer will be able to manage the command line without much difficulty.

In what situations can the command line be useful?

There are a number of reasons for using the command line. There are also situations in which it is simply impossible to do without its use. And in some cases, the fulfillment of certain Windows features, as well as setting up the operating system through the command line is more convenient and faster.

Let's take the situation with viruses. There are virus programs that completely block the graphical interface user (so-called SMS banners). As a rule, these viruses display a window on the computer screen in which a message is written, such as " Your computer is blocked by the Ministry of Internal Affairs" or " Your data is at risk" and so on. Such SMS banners cannot be closed by any conventional means - neither with the mouse, nor with the help of hot keys on the keyboard.

In such situations, the command line comes to the rescue. Of course, in order to call it, you need to do certain actions with the computer, but this is not about that now.

One more situation. Let's say Windows XP (or any other version) is just stopped working, and important data remained on the hard disk, which urgently need to copy to a flash drive. If you have at least installation disk with Windows, then a certain moment installation of the operating system (without waiting for the installation to complete), you can call command line and copy this data. This feature often comes in handy in the case of a damaged disk, when, for example, Windows installation stops while copying installation files to the hard drive.

The command line is also capable of quickly calling various standard master tuners operating system (such as Network Configuration Wizard) or system tools such as Registry Editor, Component Services, and others. It can also be used to produce direct various parameter settings Windows, exercise file management, run programs and do many other things.

How to use the command line

On various computer forums and websites, you can find hundreds of manuals on using certain programs, performing some system settings and a host of other articles in which the authors call for the use of the command line. Many inexperienced users are immediately lost when they see the phrase " Run Command Prompt...". If you are also one of them, it will be very useful for you to familiarize yourself with the work of this useful tool. Let's start with how to call it.

How to call the command line

Starting from Windows XP and up latest version this family of operating systems, the command line is invoked through the dialog " Run» (« Run”), in which you need to enter the command - “ cmd". This dialog is launched by pressing the Win keys simultaneously. + R:

In Windows XP (unlike later versions) in the menu " Start" there is a special label, which is called " Execute...". If you click on it, the dialog will also start.

You can call the command line in other ways. Here they are:

Performing one of the above actions will lead to the launch of a black window with a blinking cursor - this is the command line. Let's see how to work with it.

IN . As well as in the 10-ke, about the features of which you can learn more.

Working on the command line

To " cmd"executed this or that command, it is enough to enter it into the window, and then press the Enter key. To check, you can enter " help» - this command will display a list of all available standard commands.

As you can see, there are many of them. However, these are not all commands that can be executed using the command line. There are many different programs that can also be controlled through this console. Basically, " cmd" is extensible shell, which indicates the possibility of adding more and more commands to the list of actions performed by it.

You also need to know that most commands can only be executed if additional mandatory parameters, others support keys (optional). Let's try using the command line to perform some actions on files and folders in which exactly such commands will be involved.

Let's try to move from one local drive to another, view its contents, then create a folder, go to it, and create another folder in it and delete it. Interesting problem? The main thing is that to perform each individual action, you will need to use different teams. Let's start.

After starting the command line, you may have noticed the address in front of the blinking cursor: " C:/Users/Username" (in our case - here " Reptile"). The name of the last folder means your current location (the same as if you went to this folder through Conductor). And "C:\" is local disk where you are. To change the current local drive, just enter its letter and a colon immediately after it - for example, "D:".

This will take you to the "D:\" drive (or whatever). To view disk contents(or in general any folders) use the command " dir". Enter it right here and you will see a list of files and folders available on the "D:\" drive.

Now create a folder right at the root of the disk. To do this, use the command - " mkdir”, and as a parameter, separated by a space, you need to enter the name of the future folder, for example, “ mkdirxp". In this case, a folder named " xp».

After creating it, you can enter through the explorer to your disk and make sure that the folder has been created. Now let's go into it.

To go to a particular folder, use the command " cd". Here, the name of the directory to navigate to is also used as an argument. Let's introduce " cd xp” and get inside the folder ( make this folder current).

Let's create another folder in the folder using the command " mkdir". Let this be the folder 123 ».

Now delete her. To do this, enter " rmdir 123". Execute now in the directory " xp» command « dir" and you will see that the folders " 123 " no more.

If you want to learn more about the description of a particular command, just enter the "/?" immediately after the command, and a prompt will be displayed on the screen. For example, enter " dir/?". Another option to launch a prompt: " help directory».

Remembering all existing commands is not easy - there are a lot of them. The official Microsoft website has the most complete guide on the command line, although the descriptions issued by the command help quite enough.

Related videos

If you notice an error, select a piece of text and press Ctrl + Enter
SHARE: