Basic cmd commands – just something useful. All Windows command line commands in one place. The need to use the command line

A byte-by-byte comparison of two or more files. Team comp allows you to compare files located on different drives and in different directories. When comparing files using the command comp their names and locations are displayed. Command executed without parameters comp requests files for comparison.

Syntax

comp [file1] [file2] [/d] [/a] [/l] [/n=number of rows] [/c]

Options

file1 Specifies the name and location of the first file or set of files to compare. You can use wildcard characters (* and ?) to specify multiple files. file2 Specifies the name and location of the second file or set of files to compare. You can use wildcard characters (* and ?) to specify multiple files. /d Output differences in decimal format. (The default is hexadecimal.) /a Outputting differences in symbolic form. /l Print the line number where the difference is detected instead of displaying the byte offset. /n=number of rows Comparing the first few strings specified by the parameter number of rows, both files, even if the files are different sizes. /c Case insensitive comparison. /? Display help on the command line.

Notes

  • Comparing files with the same name

    If files with the same names are being compared, they must be in different directories or on different drives. If in the parameter file2 file name is not specified, the name is assumed file2 matches the name file1. You can use wildcard characters (* and ?) to specify file names.

  • Incomplete parameter setting file1 And file2

    If the file names file1 or file2 entered incompletely or a parameter file2 missed, program comp will display a request to obtain the missing information. If the parameter file1 contains only the drive or directory name without the file name, the command comp compares all files in a given directory with a file file2. If the parameter file2 contains only the drive or directory name, it will be assumed that the file name file2 same as in parameter file1.

  • Displaying information about mismatches

    During the comparison process, the program comp Prints messages indicating the location of mismatched bytes in files. Each message includes information about the address offset of the mismatched bytes and the contents of those bytes (in hexadecimal unless specified). /a or /d). These messages have the following format:

    Comparison error OFFSET xxxxxxxx

    After 10 differences are found, the team's work comp stops and the following message is displayed:

    10 differences found. The comparison is complete.

  • Comparing files of different sizes

    To compare files of different sizes, you must specify the parameter /n. If the files are of different sizes, comp displays the following message:

    Different file sizes

    Press the key Y to compare the next pair of files. Press the key N to complete the command comp.

    When you press a key Y team comp continues comparison with the specified parameters until the key is pressed N or this command is re-entered.

    When working with files of different sizes, use the option /n to compare only the beginnings of files.

  • Sequential file comparison

    If you use wildcards (* and ?) to specify multiple files, comp will find the first file matching the pattern file1, and will compare it with the corresponding file file2, if it exists. Team comp displays comparison results and compares all files matching the pattern file1. After completion of work comp the following message will be displayed:

    Compare other files?

    To compare other files, press Y. Team comp will ask for the locations and names of new files. To end the comparison, press N. When you press a key Y team comp prompts for command line options. If these parameters are not specified, the program comp uses the parameters entered earlier.

  • If files are not found

    If the team comp the specified files were not found, a request to continue the comparison is displayed.

Examples

To compare the contents of the C:\Reports directory with the contents of the backup directory \\Sales\Backup\April, enter the following command:

comp c:\reports\\sales\backup\april

To compare the first ten lines of files in the \Invoice directory and print the result in decimal format, enter the following command:

comp \invoice\*.txt \invoice\backup\*.txt /n=10 /d

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 reboot 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.

02/12/15 21.3K

Why is there such chaos in the world? Yes, because the administrator of our system forgot to fulfill his duties. Or I just lost the list of cmd commands from our world. Although this is a somewhat original look at the existing order of things, it nevertheless reflects part of the truth we need: using the command line, you can easily bring order to your computer:

What is the command line

The command line is the simplest tool for managing your computer's operating system. Control occurs using a number of reserved commands and a set of text keyboard characters without the use of a mouse ( in the Windows operating system).

On UNIX-based systems, you can use the mouse when working with the command line.

Some commands came to us from MS-DOS. The command line is also called the console. It is used not only to administer the operating system, but also to manage common programs. Most often, the most rarely used commands are included in this set of commands.

The advantage of using cmd basic commands is that it consumes a minimal amount of system resources. And this is important in case of emergency situations when all the computer’s powers are, one way or another, involved.

cmd implements the ability to execute and create entire batch files, which represent a specific order of execution of a number of commands (scripts). Thanks to this, they can be used to automate certain tasks ( account management, data archiving and more).

The Windows command shell for manipulating and redirecting commands to certain operating system utilities and tools is the Cmd.exe interpreter. It loads the console and redirects commands in a format that the system understands.

Working with the command line in the Windows operating system

You can call the console in Windows in several ways:

Both methods involve running the console as the current user. That is, with all the rights and restrictions that are imposed on its role in the operating system. To run cmd with administrator rights, you need to select the program icon in the Start menu and select the appropriate item in the context menu:


After launching the utility, you can get help information about commands and the format for writing them in the console. To do this, enter the help statement and press “Enter”:

Basic commands for working with files and directories

The most frequently used commands are:

  • RENAME – renaming directories and files. Command syntax:

RENAME | REN [drive/path] original file/directory name | final filename
Example: RENAME C:UsershomeDesktoptost.txt test.txt

  • DEL (ERASE) – used to delete files only, not directories. Its syntax is:

DEL | ERASE [processing method] [filename]
Example: Del C:UsershomeDesktoptest.txt/P

By processing method we mean a special flag that allows you to implement a certain condition when deleting a file. In our example, the “P” flag enables the display of a permission dialog for deleting each file:


More information about the possible values ​​of the “processing method” parameter can be found in the technical documentation for the Windows operating system.

  • MD – allows you to create a folder at the specified path. Syntax:

MD [drive:] [path]
Example:
MD C:UsershomeDesktoptest1test2

The example will create a subfolder test2 within the test1 folder. If one of the path's root folders does not exist, it will be created too:

  • RD ( RMDIR) – deleting a specific folder or all directories at a specified path. Syntax:

RD | RMDIR [process_key] [drive/path]
Example:
rmdir /s C:UsershomeDesktoptest1test2

The example uses the s flag, which will cause the entire branch of directories specified in the path to be deleted. Therefore, you should not use the rmdir command unnecessarily with this processing key.

In the next section, we'll take a closer look at network cmd commands.

Commands for working with the network

The command line allows you to manage not only the PC file system, but also its network capabilities. The console's network commands include a large number of operators to monitor and test the network. The most relevant of them are:

  • ping – the command is used to monitor the network connection capabilities of a PC. A set number of packets are sent to the remote computer and then sent back to them. The transmission time of packets and the percentage of losses are taken into account. Syntax:

ping [-t] [-a] [-n counter] [-l size] [-f] [-i TTL] [-v type] [-r counter] [-s counter] [(-j host_list | - k node_list)] [-w interval] [target_PC_name]

Example command implementation:
ping example.microsoft.com
ping –w 10000 192.168.239.132

In the last example of the cmd ping command, the request is sent to the recipient with the specified IP address. The waiting interval between packets is 10,000 (10 sec). By default this parameter is set to 4000:

  • tracert – used to determine the network path to a specified resource by sending a special echo message through the protocol
  • ICMP (Control Message Protocol). After running the command with parameters, a list of all routers through which the message travels passes is displayed. The first element in the list is the first router on the side of the requested resource.

The cmd command tracer syntax is:
tracert [-d] [-h maximum_hop_number] [-j node_list] [-w interval] [target_resource_name]
Example implementation:
tracert -d -h 10 microsoft.com

The example traces the route to a specified resource. This increases the speed of the operation due to the use of the d parameter, which prevents the command from attempting to obtain permission to read IP addresses. The number of transitions (jumps) is limited to 10 using the set value of the h parameter. By default, the number of jumps is 30:

shutdown [(-l|-s|-r|-a)] [-f] [-m [\PC_name]] [-t xx] [-c “messages”] [-d[u][p]: xx:yy]
Example:
shutdown /s /t 60 /f /l /m \191.162.1.53

The remote PC (m) with the specified IP address (191.162.1.53) will shut down (s) after 60 seconds (t). This will force you to log out of all applications (f) and the current user's session (l).

A byte-by-byte comparison of two or more files. Team comp allows you to compare files located on different drives and in different directories. When comparing files using the command comp their names and locations are displayed. Command executed without parameters comp requests files for comparison.

Syntax

comp [file1] [file2] [/d] [ /a] [/l] [/n=number of rows] [/c]

Options

file1 Specifies the name and location of the first file or set of files to compare. You can use wildcard characters (* and ?) to specify multiple files. file2 Specifies the name and location of the second file or set of files to compare. You can use wildcard characters (* and ?) to specify multiple files. /d Print differences in decimal format. (The default is hexadecimal.) /a Output differences in symbolic form. /l Print the line number where the difference was detected instead of displaying the byte offset. /n=number of rows Comparing the first few strings specified by the parameter number of rows, both files, even if the files are different sizes. /c Case insensitive comparison. /? Display help on the command line.

Notes

  • Comparing files with the same name

    If files with the same names are being compared, they must be in different directories or on different drives. If in the parameter file2 file name is not specified, the name is assumed file2 matches the name file1. You can use wildcard characters (* and ?) to specify file names.

  • Incomplete parameter setting file1 And file2

    If the file names file1 or file2 entered incompletely or a parameter file2 missed, program comp will display a request to obtain the missing information. If the parameter file1 contains only the drive or directory name without the file name, the command comp compares all files in a given directory with a file file2. If the parameter file2 contains only the drive or directory name, it will be assumed that the file name file2 same as in parameter file1.

  • Displaying information about mismatches

    During the comparison process, the program comp Prints messages indicating the location of mismatched bytes in files. Each message includes information about the address offset of the mismatched bytes and the contents of those bytes (in hexadecimal unless specified). /a or /d). These messages have the following format:

    Comparison error OFFSET xxxxxxxx

    After 10 differences are found, the team's work comp stops and the following message is displayed:

    10 differences found. The comparison is complete.

  • Comparing files of different sizes

    To compare files of different sizes, you must specify the parameter /n. If the files are of different sizes, comp displays the following message:

    Different file sizes

    Press the key Y to compare the next pair of files. Press the key N to complete the command comp.

    When you press a key Y team comp continues comparison with the specified parameters until the key is pressed N or this command is re-entered.

    When working with files of different sizes, use the option /n to compare only the beginnings of files.

  • Sequential file comparison

    If you use wildcards (* and ?) to specify multiple files, comp will find the first file matching the pattern file1, and will compare it with the corresponding file file2, if it exists. Team comp displays comparison results and compares all files matching the pattern file1. After completion of work comp the following message will be displayed:

    Compare other files?

    To compare other files, press Y. Team comp will ask for the locations and names of new files. To end the comparison, press N. When you press a key Y team comp prompts for command line options. If these parameters are not specified, the program comp uses the parameters entered earlier.

  • If files are not found

    If the team comp the specified files were not found, a request to continue the comparison is displayed.

Examples

To compare the contents of the C:\Reports directory with the contents of the backup directory \\Sales\Backup\April, enter the following command:

comp c:\reports\\sales\backup\april

To compare the first ten lines of files in the \Invoice directory and print the result in decimal format, enter the following command:

comp \invoice\*.txt \invoice\backup\*.txt /n=10 /d

A byte-by-byte comparison of two or more files. Team comp allows you to compare files located on different drives and in different directories. When comparing files using the command comp their names and locations are displayed. Command executed without parameters comp requests files for comparison.

Syntax

comp [file1] [file2] [/d] [/a] [/l] [/n=number of rows] [/c]

Options

file1 Specifies the name and location of the first file or set of files to compare. You can use wildcard characters (* and ?) to specify multiple files. file2 Specifies the name and location of the second file or set of files to compare. You can use wildcard characters (* and ?) to specify multiple files. /d Output differences in decimal format. (The default is hexadecimal.) /a Outputting differences in symbolic form. /l Print the line number where the difference is detected instead of displaying the byte offset. /n=number of rows Comparing the first few strings specified by the parameter number of rows, both files, even if the files are different sizes. /c Case insensitive comparison. /? Display help on the command line.

Notes

  • Comparing files with the same name

    If files with the same names are being compared, they must be in different directories or on different drives. If in the parameter file2 file name is not specified, the name is assumed file2 matches the name file1. You can use wildcard characters (* and ?) to specify file names.

  • Incomplete parameter setting file1 And file2

    If the file names file1 or file2 entered incompletely or a parameter file2 missed, program comp will display a request to obtain the missing information. If the parameter file1 contains only the drive or directory name without the file name, the command comp compares all files in a given directory with a file file2. If the parameter file2 contains only the drive or directory name, it will be assumed that the file name file2 same as in parameter file1.

  • Displaying information about mismatches

    During the comparison process, the program comp Prints messages indicating the location of mismatched bytes in files. Each message includes information about the address offset of the mismatched bytes and the contents of those bytes (in hexadecimal unless specified). /a or /d). These messages have the following format:

    Comparison error OFFSET xxxxxxxx

    After 10 differences are found, the team's work comp stops and the following message is displayed:

    10 differences found. The comparison is complete.

  • Comparing files of different sizes

    To compare files of different sizes, you must specify the parameter /n. If the files are of different sizes, comp displays the following message:

    Different file sizes

    Press the key Y to compare the next pair of files. Press the key N to complete the command comp.

    When you press a key Y team comp continues comparison with the specified parameters until the key is pressed N or this command is re-entered.

    When working with files of different sizes, use the option /n to compare only the beginnings of files.

  • Sequential file comparison

    If you use wildcards (* and ?) to specify multiple files, comp will find the first file matching the pattern file1, and will compare it with the corresponding file file2, if it exists. Team comp displays comparison results and compares all files matching the pattern file1. After completion of work comp the following message will be displayed:

    Compare other files?

    To compare other files, press Y. Team comp will ask for the locations and names of new files. To end the comparison, press N. When you press a key Y team comp prompts for command line options. If these parameters are not specified, the program comp uses the parameters entered earlier.

  • If files are not found

    If the team comp the specified files were not found, a request to continue the comparison is displayed.

Examples

To compare the contents of the C:\Reports directory with the contents of the backup directory \\Sales\Backup\April, enter the following command:

comp c:\reports\\sales\backup\april

To compare the first ten lines of files in the \Invoice directory and print the result in decimal format, enter the following command:

comp \invoice\*.txt \invoice\backup\*.txt /n=10 /d