All commands in windows. What are the benefits of using the command line?

Command line - special program, which allows you to control the operating system using text commands entered in the application window. Its interface is completely text-based, unlike familiar look operating system.

Performing actions using text expressions, of course, is not as convenient as clicking on icons on the screen, selecting menu items, opening program windows. But sometimes it is simply necessary to open the command line, for example, in case of problems with the system, working with network and equipment settings, calling system applications. Here are some examples of its use:

  1. The systeminfo command allows you to collect information about the system, including installed updates and network information. IN graphical interface It is not possible to obtain such data.
  2. chkdsk - checks the disk for errors and generates a report.
  3. sfc /scannow is a useful command to start scanning and repairing damaged files.
  4. ipconfig - allows you to find out the IP address of your computer in a split second.
  5. ping - check the network operation in case of problems with the router.
  6. help - the command line will display a list of possible commands with brief information about them.

These are just a few examples beneficial use this application. In addition, through the program window you can quite successfully work on the computer without using a mouse.

Switching methods

There are several options to open the Windows Command Prompt:

In versions higher than Windows 8, in order to apply this method, you need to click on the magnifying glass next to the user name.


Also for quick launch you can create a desktop shortcut and hotkeys. You can create a shortcut like this:

  1. In the Explorer window, find the folder “Windows\System32”, in it right click Click on the cmd.exe file, then “Create a shortcut” and select a name for it.
  2. Right click on empty space on the screen, find “Create shortcut” in the context menu. In the field that appears, type C:\Windows\System32\cmd.exe. Next, select a name and click OK.

Now you can assign hotkeys. Call the context menu of the created shortcut, click “Properties”, “Shortcut” tab, in the “ Quick call» enter the required combination.

Please note that when launched using the shortcut, search box and Explorer, the command line is launched from the System32 folder, and using the “Run” item of the Start menu from the Users folder of your computer.

Opening with extended rights

Among the methods discussed, some allow you to enable the command line as an administrator. The point is that even if in your current work you use account Administrator, you do not have full rights to control the system. This is done to improve reliability and reduce the risk of damage from malware.

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 Windows system. IN in this case The cmd command runs the cmd.exe executable file located in the system32 folder.

C:\WINDOWS\system32\cmd.exe

On some versions Windows item The run menu 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 (button new task-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 while working).

On the Fonts and Colors tabs, everything is simple: select the size, type and color of the font, as well as background color windows. 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 stripes scroll). 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. That's why I always set the buffer much higher more sizes windows. 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 them full list 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 through reverse order). You can scroll through files to a specific letter or letters. For example, by typing the letter s and by pressing Tab, you can scroll through only files and folders starting with this letter ( s system, s ystem32, s ystem.ini, etc.) . How you can use it:

For example, you need to go from the root of drive C to the system32 folder, find and run in it control panel. 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 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 operating system GNU Linux command the 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 whole series others) using the extension program context menu FileMenuTools:

Programming in Cmd (introduction for beginners)

This is just an introduction to cmd commands, don’t judge strictly, the article was written for Novikov, I think it will be useful for many others =)
Probably many people don’t even suspect that cmd is a universal shell,
which allows you not only to administer the system, but also to program!
Of course, the level of the language is not as high as, for example, with, but still...

First, let's write a small program that will output a line written to a variable.
We go to the C:\ drive and create something like program_1.cmd there (*.bat is possible)
open it with notepad and enter the following lines there:

rem program_1
cls
@echo off
color 0A
set string=Hello World!!!
echo %string%

rem - used to describe comments
cls - if anyone else doesn’t know, this is screen clearing
@echo off - turn off the display of commands on the screen. Pay attention to @
before ECHO! It prevents commands from being echoed on a separate line.
color 0A - set the background and text color
set string=Hello World!!! - set is used to describe variables
echo %string% - displays a variable, pay attention to %%, this
denotes that it is indeed a variable and not a string!

We've sorted out the code, now let's look at the outcome of the program! We launch it for execution via cmd:
program_1.cmd
The execution result will be, you guessed it, Hellow World!!! Bright green letters on a black background

Now let’s complicate the problem a little, add a condition to this code!

rem program_2
cls
@echo off
color 0A
set a=1
set timer=10
if %a%==1 (shutdown /r -t %timer% -c "You got screwed"
) else (echo a!=1)

I think you've already guessed what the output will be. We compare the value written to the variable “a” with 1, if the condition is true, then the computer will reboot in 10 seconds, otherwise the output will read that a!=1. The example is banal and simple,
Well, at least it’s understandable for many.

Now let's move on to cycles. Let's look at the most basic example:
rem program_3
cls
@echo off
color 0A
for /l %B in (0,1,10) do echo %B

This program will display numbers in a column, from 0 to 10 in increments of 1 =) everything is as simple as...
And now a little more complicated, for can be used for more significant purposes,
for example, to enumerate files, for example you can write in cmd:

for %B in (C:*.cmd) do (echo %B)

In return you will receive all your programs with the extension *.cmd

Also for loop you can iterate through directories, for example

for /d %B in (C:*) do echo %B

Will show all directories on the C:\ drive (Please note, only directories, not subdirectories!)

Now let’s write an essential program that will select emails from the database and write them to another file.

(for /f "tokens=1-5" %A in (users.txt) do @echo %D) > emails.txt

For example, our base is “ideal”, like:

Vasya Pupkin heck [email protected] 81231111111
Dima Ivanov lamer [email protected] 81232222222
Genya Petrov lamer [email protected] 81233333333
Egor Sidorov lamer [email protected] 81234444444
Anton Popovich lamer [email protected] 81235555555
Kostya Terentev lamer [email protected] 81236666666
Vanya Onisenko lamer [email protected] 81237777777
Misha Loshenko lamer [email protected] 81238888888
Vlad Sorochinskiy lamer [email protected] 81239999999

Using a loop, we go through all the words and write 4(%D) to the file emails.txt =)

What else can you do with cmd?

I'll describe my example. I am creating websites that use the database mysql data. I work with the database through the console, which is more familiar to me. So as not to worry, I wrote a small program mysql.cmd that will connect to it:

PHP code:
v:
cd usrlocalmysql4bin
mysql.exe -u root –p pass

v – virtual disk where denver stands
root – username
pass – user password

All we have to do is launch it and enjoy working with the database
PS Well, that's all! The article turned out to be small, but I still hope that it will be useful to someone =)

Most users personal computers do not face the need to use any cmd commands. 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 software, which 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 understandable to the system form. Externally, of course, the program looks like simple user not very familiar, 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 Start menu/ standard programs/ then select “Command Line” 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 system folder C:\Windows\system32 and select the CMD.exe program.

Most of the most important commands It is possible to obtain using the Help command. After entering of this request teams will appear CMD Windows with information about their methods of use. 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 - command creates new folder(catalog). 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 allows you to move several folders at a time.

Basic commands for working with files

These commands cmd file may 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 work tough disks or change volume labels, as well as defragmentation.

  • Compact - the command allows you to display and configure compression in the file NTFS system. Using this command you can significantly save disk space.
  • Format - formats a disk or floppy disk. Please note that formatting will result in complete removal 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. Happening this process 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 it is restored in this way text documents from damaged floppy disks.
  • 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, as well as 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 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. Commands will help you clear the screen and change it 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 launch a new command interpreter window Windows strings. 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 - command provides information about hardware addresses network adapters. In this case, you can find out both local and remote addresses;
  • netsh.exe - the command opens another line. Using it, if necessary, you can configure the network. Many experienced users consider 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 in automatic mode. 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 make things easier for users. It should be remembered that these commands should only be used when you are confident in the action being performed. Incorrect use of CMD commands may result in serious problems in the operation of a personal computer.

List of useful commands

In addition to the above commands, there is also huge amount 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 the given CMD commands will simplify the 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 losses important information and other undesirable consequences.

Command line or as it is also called cmd in the Windows 8 operating system is the same as in the younger ones Windows versions 7, Windows Vista, Windows XP, it follows that the same commands work the same in all versions.

So let's first figure out how to launch the command line. To do this, you must have a working computer with an operating system.

Some commands if you work through an account regular user For security reasons, you may not have enough rights to execute, so always run the command prompt with administrator rights. There are 2 ways to launch the command line:

In the window that appears, write cmd and click OK.

A command prompt window will open with a black background.

2) More quick way: via the hot keys Win+R, here also in the window that appears we write cmd, press ok.

In Windows 8, you can only use method 2, since there is no Start menu. Let's write our first help command which will display a list of all available commands with brief explanations.

List of all existing Windows command line commands:

ASSOC Print to screen or modify mappings based on file name extensions.
ATTRIB View and modify file properties.
BREAK Locks or unlocks enhanced CTRL+C processing in DOS.
BCDEDIT Sets properties in the boot database that allows you to control the initial boot.
CACLS Lists data and modifies access control lists (ACLs) on files.
CALL Calls one batch file from another, and can also pass input arguments.
CD
CHCP Output or set encoding.
CHDIR Displays the name or moves to another folder.
CHKDSK Diagnostics of the drive for errors.
CHKNTFS Shows or changes drive diagnostics during boot.
CLSO clearing the display of all symbols.
CMD Launches a Windows command line program. 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 differences and compares the contents of two files.
COMPACT Changes and shows file compression in NTFS.
CONVERT Changes disk volumes FAT 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 settings.
DISKCOMP Compares and shows the differences between 2 floppy drives.
DISKCOPY Creates a copy of the contents of one flexible storage 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 status and attributes of a device driver.
ECHO Outputs text information and changes the display mode of commands on the screen.
ENDLOCAL Brings the environment localization to a close for the batch file.
ERASE Destroys a file or files.
EXIT Terminates the command line program
F.C. Shows the differences between two files or two sets of files and also compares them
FIND Searches for a text string in files or in one file.
FINDSTR Advanced Search text strings in files.
FOR Cycle. Repeats execution of the same command specified quantity once
FORMAT Formatting the drive for use with Windows.
FSUTIL Shows and sets file system attributes.
FTYPE Allows you to change and view file types, which are mainly used when matching by file name extensions.
GOTO Transfers control to another specified command.
GPRESULT Displays information about group policy for a computer or user.
GRAFTABL Gives Windows feature show extended character set in graphical mode.
HELP Lists all data about existing Windows 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.
M.D. 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 the size of one screen.
MOVE Moves files from one location to another.
OPENFILES Shows files that are open on shared folder remote user.
PATH Outputs or sets full path to executable files.
PAUSE Stops execution of command line commands and displays information text.
POPD Restores the previous value active folder, which was saved using the PUSHD command.
PRINT Prints the contents of a text file.
PROMPT Modifies the Windows command line prompt.
PUSHD Saves the active folder value and moves to another folder.
R.D. Destroys a directory.
RECOVER Revives readable data from a bad or damaged hard drive.
R.E.M. Places comments in batch files and the CONFIG.SYS file.
REN Changes the name of both files and folders.
RENAME Similar team REN.
REPLACE Swaps files.
RMDIR Destroys a directory.
ROBOCOPY Advanced tool for copying files and entire folders
SET Shows, installs and destroys environment variables Windows.
SETLOCAL Localizes environment changes in a batch file.
S.C. Allows you to work with services
SCHTASKS Allows you to run any programs and execute them sequentially necessary commands according to a given plan
SHIFT Changes the position (shift) of substituted parameters for a batch file.
SHUTDOWN Shuts down the computer.
SORT Sorts input according to specified 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 computer configuration.
TASKLIST Shows a list of all running processes with their identifiers.
TASKKILL“Kills” or stops the process.
TIME Sets and displays the system time.
TITLE Sets the window name for the current session of the command line interpreter CMD.EXE
TREE Displays drive directories in a convenient visual form.
TYPE Displays the contents of text files.
VER Outputs brief information about the Windows version.
VERIFY Checks for file writing errors on the drive.
VOL Displays marks and serial number drive volumes.
XCOPY Creates a copy of files.
WMIC Prints WMI on the command line.