Launch the command line in various modes. How to type commands on the command line. Command syntax. Network CMD commands.

💖 Do you like it? Share the link with your friends

Until the moment when operating systems learned to “communicate” with users using the familiar graphic images, input and output of information to the 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 professional programmers, system administrators and other IT industry workers. For ordinary users Operating system manufacturers have created a convenient GUI, which allows you to “communicate” with a computer or, say, a smartphone using a mouse or pressing buttons on the screen.

There are several alternative and easy-to-use programs for those who are rightfully limited to the classic invitation. When writing folder paths, make sure that you don't need to leave any spaces, and if there are spaces, you should enclose them between them.

If you have any questions you're still aware of, the important thing is that the next time you need to run a command from a prompt, you know what you're doing without crashing or scaring yourself. Command line also refers to a closed angle bracket, which indicates that the command line interface is ready to accept commands.

Despite this, every operating system (including Windows XP, 7, 8, etc.) still supports input and output of information via text commands. Team Windows string is a clear example of this. Let's figure out what it is.

What is the command line

First of all, this is a program cmd.exe, located in the system32 directory of the operating system folder. Possible location: C:\Windows\system32\cmd.exe. The path may differ depending on Windows versions and the location of its installation.

How to open the command line

Press Enter and if prompted, enter your administrator password or confirm. Click "Programs", click "Accessories" by left clicking in command line If prompted, enter the administrator password or confirm. Difference between prompting commands as a standard user and prompting commands as an administrator. Press Enter. . When you open Command Prompt as a standard user, you can use Command Prompt to run commands, but not all commands can be executed because some of them require you to be logged in as an administrator.

IN general outline, the command line is operating system tool, usually consisting of an OS shell and a text interface. The shell provides the user with tools for " communication"with the operating system, which, in this case, are text commands.

The command line of Windows operating 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 GUI. The need to understand and know all of these commands makes it difficult for ordinary users to use the command line to manage the operating system. However, this is not as difficult as it seems at first glance.

How to run command prompts as an administrator

To run these specific commands on the command line, you need what are called high or administrative privileges. To run the command prompt as an administrator. Click on the "Click on Programs" button, click on Accessories, right-click on Command Prompt. Select Run as administrator if prompted, enter your administrator password, or confirm the prompt to open Command Prompt with administrator rights.

How to enter commands on the command line

For more information about each of the commands that will be displayed, enter the help command name.

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

In what situations can the command line be useful?

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

Don't miss the next lessons!

  • Throw it in and if all goes well, you're hooked!
  • Some servers will relay the message to you, but many others will not.
Now let's see the specific 5 steps we can take after logging in. Additionally, you'll want to further configure whether an add-on is loaded or a macro is run at the beginning of the process. About commands, parameters and options.

Using the command line option does not mean that you have to enter the full boot command at the command prompt. Boot file with a parameter similar to the following. This parameter consists of a string and a word or abbreviation indicating the effect of the parameter. Parameter names cannot be abbreviated and are not case sensitive. However, its parameters are sometimes upper and lower case.

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.

Running the command line in general

Load command traces and names. Check the file path on your computer. Use the option when you add it to the Run command.

  • Alternatively, click Browse to locate and select the file.
  • In this case, quotes are automatically provided.
The next time you launch the application, it will open as usual. Next section. Please note the use of command line options.

  • You can only use one step at a time.
  • Options and options have uppercase and lowercase letters.
  • Include a space before each option and one before each option.
Make the option reusable by creating a link. If the parameter is a path included on the computer and the pathname contains a space, you need to enclose it in quotes.
  • In the "Enter a link name" field, enter a name for the link and click "Done."
  • Accessible from desktop.
Every time you want to use a link to launch an application, double-click it.

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 that’s not about that now.

Another situation. Let's say Windows XP (or any other version) just stopped working, and there is important data left on the hard drive that urgently needs to be copied to a flash drive. If you have at least one handy installation disk with Windows, then at a certain point in the installation of the operating system (without waiting for the installation to complete) you can call the 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 during copying installation files to the hard drive.

Working on the command line

If you are using the command line and want information about the latest available options, answer “Yes” or “No” to the “Was this information helpful” question at the end of this section. Disclaimer for automatic translation. This article has been automatically translated software for translation, not by a person.

Changing system settings

Because the article has been automatically translated, it may contain errors in syntax, grammar, or usage of words. This guide explains how to create applications and deploy them on different mobile platforms using the CLI cable. This tool allows you to create new projects, create them on multiple platforms and run them in an emulator.

The command line is also capable of quickly calling various standard master tuners operating system (for example, Network Setup Wizard) or system tools such as Registry Editor, Component Services, and others. It can also be used to produce direct settings of various parameters Windows, manage files, run programs and perform many other actions.

What is the command line for?

To install the tool's command line cord, follow these steps. Instead, the first-level merge directory provides a place to specify assets that will be deployed to specific platforms. Each of the internal merge subdirectories mirrors the tree structure of the source trees, allowing you to overwrite or add files as needed. Customize each platform. . After installing the service cable, you can always upgrade to the latest version by running the following command.

How to use the command line

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

To install a specific version, use this syntax. Cordova 0 is the first version to support the command line interface described in this section. Where applicable, more detailed information about upgrading to 0 is available in the platform guides. To complete the operation by updating access privileges.

This is what you will see on your monitor. This punctuation precisely indicates the command member: if the button is pressed after the semicolon, then the command will be executed, and vice versa if the semicolon is omitted, and vice versa will have a simple return to the head.

How to open the command line

From Windows XP to latest version this family of operating systems, the command line is called through the dialog " Execute» (« Run"), in which you need to enter the command - " cmd" This dialog is launched by simultaneously pressing the Win keys + R:


This rule has some exceptions, but in fact it can be considered a universal rule. It also returns the number of records returned and the time it took to complete the query. However, as said, this is just a convention and nothing more. Most operating systems support filename association, associating a file class with an application.

If you change your language frequently, you can create a batch process to automate the process. Open Notepad and click the following commands. Create an "icon" and drag it onto your desktop or menu as you wish. Go to system settings, click on the international icon, and on the Language tab, the preferred language will be the first one from the list.

In Windows XP (unlike subsequent versions) in the menu " Start"There is a special shortcut called " Execute..." If you click on it, the dialogue will also start.


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

Command Line Arguments

Displays a list of all command line options. Show all help options. Shows license information and outputs. Shows initial messages in detail. Launch without user interface. Do not download motifs, gradients, palettes or brushes. Often useful in non-interactive areas where execution time needs to be optimized.

Don't load any symbols. Don't show the start screen on startup. It is helpful to find and possibly disable overclocking features or hardware. Useful if the plugin path or machine specifications are different. Execute commands in a non-interactive manner. If command - commands are read by standard input.

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

IN . Just like in 10, about the features of which you can find out in more detail.

Defines the procedure used to handle batch processes. Do not show dialog boxes for errors and warnings. Prints all messages on the console. Debugging in the case of a block. Enable debugging of non-fatal signals. Make sure all warnings are lethal.

There are many reasons why one might find work with modules: Many companies need to collect information from clients and provide them with the ability to submit modules. In these cases, the benefit is twofold: users can edit them directly from their computer without having to print and scan them; The operator receives the completed form digitally and can then select responses from various fields on the form to copy and paste them elsewhere.

Working on the command line

To " cmd"executed this or that command, just 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.


Network CMD commands

This is another story aimed at beginners. Therefore, all predictions that the command line will one day be alive are falsely prophetic. Every administrator will tell you that he simply cannot do without it, not because he decided to, but because he really cannot. It displays the contents of the current directory, displaying a list of files and subdirectories within it. If you want to view the contents of any other directory, you must add it as additional parameter. We have already used two important command line terms - option and option.

As you may have noticed, there are many of them. However, these are not all the 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 expandable shell, which indicates the possibility of adding more and more new commands to the list of actions it performs.

The option tells the shell how to execute the command if we have any requirements and the parameter gives Additional information about the command object. Run the following sequence of commands and see the result. A "Permission Denied" warning and denial will also be received if you try to run a command for which you do not have necessary rights. But we'll talk about them again. It combines the capabilities of analytical transformations, numerical calculations and graphical representation obtained results.

It is focused on working with data arrays - vectors, matrices, multidimensional arrays, cell arrays and an array of records. The core of the system is constantly supplemented by application packages, called tools, that solve problems in specific areas of science and technology. Here are the names and designations of some of the most commonly used among them.

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

This allows each user to create his/her own programs and functions that meet specific needs in his/her area of ​​scientific interest. Once written, these programs execute in the same way as other system functions. In other words, you have the ability to create your own programming tools.

Graphical results are displayed in a separate window. The following rules apply when entering commands. If a command ends with a ";", the result of its execution is not displayed. This saves time and effort when implementing complex expressions that differ slightly from each other sequentially. In this case, either a comma or a semicolon is used as the delimiter; - a character that suppresses the output of the previous command. The % character percentage is used to start the comment. You can enter multiple commands on one line. . The index exceeds the matrix size.

Let's try to move from one local drive to another, look at 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 commands. Let's begin.

After launching the command line, you might notice 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 had accessed this folder via Conductor). And "C:\" is local disk, which you are on. 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 any other). To view disk contents(or any folders) the command " dir" Enter it right here and you will see a list of files and folders available on the “D:\” drive.


Now let's create a folder right at the root of the disk. To do this we use the command - “ mkdir", and as a parameter, separated by a space, you need to enter the name of the future folder, for example, " mkdir xp" In this case, a folder will be created with the name " xp».


After it is created, you can log into your disk through Explorer 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 go to is also used as an argument. Let's enter " cd xp" and get inside the folder ( make this folder current).


Let's create another one 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, simply enter the key “/?” immediately after the command, and a hint will be displayed on the screen. For example, enter " dir/?" Another option to launch the prompt: " help dir».


It’s not easy to remember all the existing commands - there are a huge number of them. The official Microsoft website has the most complete guide on the command line, although the descriptions produced by the command help quite enough.

Video on the topic

So, the command line console is present in all versions of Windows operating systems. Early versions The OS supported MS-DOS mode directly, which made it possible to execute simple commands directly from the console. Representatives of the NT family, such as Windows 2000 or Windows Server 2003, they work according to completely different principles, but MS-DOS is also supported in them, but through virtual machine(NT Virtual DOS Machine, NTVDM), which allows you to control and administer system resources directly from the command mode console. The command mode interpreter is the cmd.exe program, which is launched through the “Start -> Run” menu. In addition, to launch the console, you can use the menu item “Start -> All Programs -> Accessories -> Command Prompt”.

By launching a command-mode console, the user can manage resources as local system, and the resources of the remote machine. There are commands that monitor the system and identify critical points in the server settings. The difference between working from the command line is the complete absence of large and cumbersome graphical utilities. Command line programs allow finer tuning in the form of key parameters listed to the right of the command itself.

Using special script files (sets of commands executed sequentially or in a programmed order), the administrator can minimize routine daily operations. Existing modern utilities can run such scripts at specified intervals without the presence of a system administrator.

The administrator himself can execute both single commands and a list of commands using special control characters (&, |). For example:

Command 1 & Command 2 - Command 1 will be executed first and only then Command 2; Command 1 && Command 2 - only after successful completion of Command 1 will Command 2 be launched.

It is possible to redirect the stream output by the program directly to text file for further processing. To do this, you must use the control character “>” and the name of the text file. An example of outputting the contents of the current directory to a text file Report.txt using dir commands is given below:

Dir>Report.txt

An administrator can launch multiple copies of the console by calling cmd.exe from the command line. Using a nested console allows you to work with environment variables operating system without any consequences for the entire system as a whole, since after closing the nested console, changes to environment variables are not saved. The setlocal, endlocal, and set commands are used to control this process.

There are many commands and utilities in modern operating systems. Remember so many different programs, and even more so their parameters
very difficult, so one of the most important parameters for each program is the combination of symbols /?. After executing a command with this parameter, the user will receive a comprehensive message about the use of the utility and the syntax of its parameters.

Please note that in the picture on the left top corner The following page uses complex syntax. So, immediately after the shutdown /? after the special separator “|” the more command is used, which allows you to display information on the screen not entirely, but in certain portions, convenient for further reading.

To close the command line console, you must run the exit command.

Who's in charge here?

According to their capabilities, console programs are divided into:

  • operating system control commands are commands such as shutdown or taskkill;
  • network commands - net and ipconfig;
  • commands for system monitoring - tasklist and systeminfo;
  • commands for file system support - dir, mkdir, copy;
  • commands for servicing hard disks - defrag and diskpart;
  • commands to support Active Directories - addrep and dsadd;
  • auxiliary commands, this section includes various utilities for creating scripts, setting up printers, working with environment variables, etc.

Let's look at typical representatives of each group and allow ourselves to give some recommendations for using the commands included in them.

Monitoring and diagnostic commands

Monitoring commands such as systeminfo and tasklist are used to identify hardware and software problems. These utilities first appeared only in the operating room Windows environment Server 2003, so administrators have not yet fully appreciated functionality these teams. So, for example, now you don’t need to go to the “Properties” tab of the “My Computer” icon - the systeminfo command will print basic information about all system components with a full decryption on the console screen. The /s parameter will display information about any remote computer. For example, to find out the configuration of the TESTSERVER computer, you would run the following command:

Systeminfo /s TESTSERVER

And the tasklist utility will show the processes running on your computer.

The tasklist utility allows you to query systems connected to a network. The /v option allows you to get detailed listings from useful information, including usernames, and the /t parameter shows the processes that loaded a specific dll file. Other useful utility- openfiles - allows you to get information about everyone open files local and remote operating system. IN previous versions Windows operating systems had to use the oh.exe command; in modern versions, it is enough to run a command on the console command line that sets the monitoring mode for all open files in the system:

Openfiles/local on

The user will receive information about all open files on the system using a command with a simple syntax:

Openfiles

The openfiles command with the /query /v options shows which users are running the processes that opened the files. Using other key parameters, you can set different information output modes.

Operating system commands

Windows Server 2003 provides administrators with new commands that help them not only diagnose the system, but also manage it. Such commands include the shutdown utility. The following can be used as key parameters for this utility:

  • /s - complete normal system shutdown;
  • /p - power off;
  • /f - shutdown active applications;
  • /d - transition to low power consumption mode;
  • /I - end the session without turning off the computer.

In the form of a tool that registers all regular shutdowns of the computer, the shutdown event handler (Shutdown Event Tracker) acts as a tool that collects and diagnoses all shutdowns performed by the administrator. It is also possible to shut down the system indicating the reason; for this you need to use the /d key.

Taskkill command, analogue kill commands in operating systems of the *nix family, it allows you to “kill” a frozen application. Together with the tasklist command, these utilities provide a powerful tool for quickly intervening in the execution of applications that represent potential threat for server performance. Among the parameters of this command, you should note the /pid key, which allows you to terminate a process by its unique identifier, and the /im key - to terminate the application with specified name. The following example terminates processes with IDs 1000 and 1240:

Taskkill /pid 1000 /pid 1240

Commands for maintenance hard drives

Optimization hard drive allows you to run the defrag command. The utility can defragment disks with file system FAT, FAT32 and NTFS. Defrag works equally well with both dynamic type disk, and with the base one. The syntax for calling this command is as follows:

Defrag disk [ -a j [ -f ] [ -v ] [ -? ]

The -a parameter provides only analysis of information on the disk, the -f parameter - optimization of information, including in the absence of the necessary disk space to create temporary files, and the -v parameter - outputs a report on the optimization progress. Don't forget that for defragmentation to succeed, the disk must contain at least 15% free space.

The fdisk command is no longer supported by the operating kernel. Windows systems Server 2003. It was replaced by the diskpart command, also intended for servicing hard drives. Split a disk into partitions, create logical drives, delete them - these are just some of the tasks solved by this utility. Basically, the diskpart command is focused on working with special script files that describe hard drive maintenance procedures. This is what calling this command looks like for the script file Scriptl.txt:

Diskpart /s Scriptl.txt

Each line of such a file is an instruction for some operation. So, for example, gives a command to create a new partition with a certain size line

Create partition logical size=2048

Network commands

Among the network commands, I would like to highlight two utilities. The first is the ipconfig command, the second is netstat. System administrators use these commands not only to monitor the network, but also to protect against dangerous programs that try to take control of the system.

Using the ipconfig utility, the user can find out network address your computer, and by calling this command with the /all parameter, get complete information about the network configuration on the local computer. The /renew parameter allows you to change network settings without rebooting the entire system.

If you notice that something wrong is happening with your computer, then the netstat command will help in this case, which will not only indicate open network ports, through which attackers could connect to your system, but also identifies processes running on the server without your knowledge. Thus, the /o switch displays information about the process identifier (PID) using this or that network connection. It is possible to see which computers on the network are communicating with your local operating system.

Commands for Directory Service Support

The entire network consists of components and is a complex hierarchical structure built in the form of a tree. The objects of such a system are sites, subnets, servers, computers, groups, users, contacts, shared network devices.

To monitor such a complex structure in operating system The dsquery command is provided for advanced searching of directory service components. This command can also be used to display information about the properties of selected components (the -attr switch). The -scope, -subtree, -onelevel, -base parameters determine the search nesting level, and the -filter key allows you to use the search filter.

The dsmod command can help if you need to modify one or more accounts for a selected directory service component. For example, you can remove a user from a group or assign a new password to them. Example change account for TestUser is given below:

Dsmod user "CN=TestUser,CN=Users,DC=bigtex,DC=net " -pwd Uf@tfmgerelt -mustchpwd yes

The dsmove command moves an object within the current domain. Using the -newname and -newparent keys, you can set a new object name and change its location.

File System Support Commands

A description of some frequently used commands for working with files and directories is presented in the table. The deltree command, which performed cascade deletion of folders and files in them, is now replaced by rmdir with the /s switch.

Little secrets of a big system

Changing the command line prompt

Find the key in the registry: Create a string parameter “PROMPT” with type (REG_EXPAND_SZ) in this key and assign one of the following values:

  • $B - vertical bar"I";
  • $D - current date;
  • $G - greater sign ">";
  • $1_ - less sign "<»;
  • $N - current disk;
    $P - current drive and path;
  • $Q - = "=";
  • $T - current time;
  • $V - Windows version;
  • $$ - dollar sign "$".

After the reboot, you will see the invitation in the form you defined.

Automatic commands

To enable the ability to auto-type commands by pressing the “Tab” key, find the key in the registry:

Then set the CompletionChar value to 9, which is the ID of the Tab key, close the registry, and restart your computer. In a console window, while typing part of a command name, you can now press the Tab key and Windows will automatically substitute the required command.

Changing console color

Find the key in the registry:

Change the DefaultCoior parameter. The -F0 value will output black text on a white background, and the IE value will surprise you with a yellow and blue console color.

Quickly launch the command line console from the context menu

Find the key in the registry:

Add subsections “CommandPrompt -> Command” to it. Set the Default parameter of the Command key to the value “cmd.exe /k cd “%1″”.

Set the Default parameter of the Command Prompt key to “Open Command Prompt”.

By right-clicking on any folder in Explorer, you can select the Open Command Prompt command, which will launch a command line console in the desired directory.

Conclusion

OK it's all over Now. We talked about the basics of working with the console. Then we give you the opportunity to explore the functionality and diversity yourself. console commands. Just don’t forget the treasured key /?, and the rest will come with time and experience



tell friends