The command line opens itself. How to open a file from the command line

Good afternoon, dear readers of the blog site, today I want to talk about the topic How to open the Windows command line / 10 ways to open the command line. What is cmd, that's what Wikipedia tells us.

cmd.exe- command line interpreter (English) command line interpreter) for operating systems OS/2, Windows CE and for a family of operating systems based on Windows NT (eng. Windows NT-based). cmd.exe is analogous to COMMAND.COM, which is used in the MS-DOS and Windows 9x families. Operating systems of the Windows NT family for the IA-32 and OS/2 architecture also have COMMAND.COM for compatibility with older programs. In the interpreter settings, it is possible to change the cursor size, font, text color and window size.

Let's look at how to open it.

How to open command prompt as administrator

Below we will look at ten ways I know how to open the command line as an administrator.

1 way to launch the command line. Before Windows 8 (unless you have to return the start button)

To open the command line, click start and enter cmd in the search field, the program icon to launch will appear at the top

or enter command line, the effect will be the same

If you need to open cmd on behalf of the Administrator, then this is done with the right button and selecting

In Windows 10, the search looks like this: you click on the magnifying glass icon and write cmd. The search result will appear at the top.

Method 2 is by using Run

Press two magic buttons win+R

The Run window will open, type cmd and press Enter.

3 The way to open the command line is through the Windows folder

Open My Computer and go to the path C:\Windows\System32 and find the cmd.exe file there. The method is not the fastest, but anyone can handle it. The essence is simple, the command line, like all utilities, has its own executable file. We find it and launch it, do not forget about the right click and the context menu with administrator mode.

4 The way to call cmd is to create it via a shortcut

In this method, we will create a Windows shortcut for the task at hand. Right-click Create-Shortcut

Specify the location of the file, write cmd here

How to name the shortcut is up to you, I’ll call it cmd too, Done

And we see that a command line shortcut has been created

5 Method to launch the command line, through the task manager

Open the task manager by right-clicking at the bottom of the screen

Go to the menu File-Run new task

We write cmd in the task and click OK and enable the command line.

6 Method to launch the command line, for those with Windows 8 and higher

We go to Start and click on the magnifying glass at the top right, or the magnifying glass can be called up from the side menu on the desktop

We enter cmd and in the search results we see the shortcut we need.

You can also press the down arrow in Start.

The start menu structure will open in which by scrolling to the right you will find the command line

7 Method to launch the command line, for those with Windows 8.1 and higher

Right-click on Start and select Command Prompt

Method 8 through standard programs in the start up of Windows 8

Open start all programs

Go to Tools - Command Prompt

9 Method using the Explorer menu in Windows 8, 8.1 and 10

Open any folder and click on the File menu on the left

and select open command line, you will immediately be offered two options: simple opening or as Administrator.

The trick is that the command line will open the current directory, not the user's folder.

Method 10 via the Shift button

Select any folder, hold Shift and right-click and from the context menu select Open command window

Launch using voice assistants

In an era when people have become so lazy that it is already difficult for them to enter something on a computer and phone. Voice assistants have arrived, Cortana, Alice, Google Assistant, they all allow you to perform various actions using your voice. Depending on what voice assistant you have, you'll need to say a magic phrase to activate it, then ask it to open a command prompt for you. Let me remind you that Cortana is only available in Windows 10.

Here we have figured out how to open the Windows command line, which method is right for you, I don’t know, I just know that there is a choice.

To do this, in Windows XP, click the “Start” button, then “Run” and enter “cmd” there. In Windows 7 - the “Start” button, enter “cmd” in the search field, right-click on the result that appears and select run from. When prompted to launch, click “Yes”.

Now you need to find the directory where the problematic file is located. Initially you are in the system directory “C:Windowssystem32”. To view the contents of the directory, type “dir /p” (“p” is responsible for page-by-page) and the computer will give you a list of files and subdirectories; use the Enter button to go to the next page. In Windows 7, "p" is optional, since this OS has the ability to scroll the contents of the command line. To display only directories, use the key “/ad” (“dir /ad”), only files – use the key “/b” (“dir /b”).

To change to another directory use the command “cd”< путь к каталогу >”(for example, by typing “cd C: Windows”, you will be taken to the Windows directory; from the initial one you can also get there with the command “cd ..”, which serves to go back one level). If you need to change the disk, enter "<буква диска>:" (for example "D:").

Now that you have found the directory and the file you need in it, you just need to enter the name of this file. The file will be opened using a program that, according to the established parameters, should open it. In the future, it is not necessary to go to the directory with the file every time; it is enough just to remember the full path to it (see the image for the step).

More than one generation of Internet users has already grown up who did not see the beginning of the rapid rise of Microsoft Corporation and do not even know how to open the command line.

A feature of this early version of the Windows operating system, which was called MS DOS, was single-tasking (all processes were performed sequentially, not in parallel) and a predominantly text-based interface.

Nowadays, most operations on a computer running Windows can be performed solely with the mouse, but in those days, even the simplest actions required knowing a lot of complex text commands.

Via a shortcut in the Start menu

Running the Run program to open the command line is a strange idea, since the required shortcut is right next door.

You can also quickly find it by searching in the Start menu.

Due to a significant change in the Start menu interface in Windows 8, this method will be implemented slightly differently.

  • First you need to go to the application tiles (new version of Start) and right-click on the free area. As a result, a panel will pop up at the bottom, providing advanced options.
    In it you need to click on the All applications icon in the lower right corner.

  • Here you can see a list with additional hidden applications, including the Command Prompt shortcut. Now you need to click on the required shortcut with the right mouse button and select the run as administrator function in the bottom panel.

Advice! Running with administrator rights is recommended because some commands simply will not run normally.

In Windows 10, search works across the entire system. Therefore, to quickly find the command line, you need to press the Win+S combination and enter the name of the program, in this case it is the command line.

Searching for an executable file on the system disk

As mentioned above, the command line is implemented through a small executable file cmd.exe.

From here we can draw a logical conclusion that this executable can be found in some folder and launched directly.

This is true, the command line executable file starting from seven is stored in the System32 subdirectory of the Windows folder.

Hidden menu in Windows 8 and Windows 10

In the last two versions of the world's most popular operating system, there is a hotkey combination to open a special menu for advanced users, which contains all the most necessary system utilities.

It opens by pressing the Win+X keys, and there is just a place in it for the command line.

Via the context menu in Windows 10 Explorer

The top ten has its own unique way of calling the command line. It consists of calling this function through Windows Explorer.

To do this, you need to open any folder and, while holding down the Shift key, right-click in any free area of ​​this folder.

As a result, an extended context menu will open, which will have the option to call the command line.

As you can see from the methods mentioned in this article, the command prompt in Windows operating systems can be accessed in many ways.

This seems for such a small program of several hundred kilobytes and with unclear functionality.

But such misunderstanding can only arise among inexperienced users.

Those people who have been actively using a computer for work and entertainment for many years understand perfectly well that cmd.exe is a powerful tool that can instantly produce results if you know how to use it.

That is why the latest versions of Windows, focused on cross-platform (and primarily on compatibility with devices with a touchscreen), not only did not lose this function, but also acquired additional features for convenient work with it.

How to Open Command Prompt in Windows

This video discusses several ways to open the command line in Windows 7. In Windows XP, Vista, the command line opens in the same way.

The Windows command line, although popular among administrators and experienced PC users, is unknown to ordinary personal computer owners. The purpose of this article is to make people aware of the benefits they will get from using it.

The Windows operating system is known for its graphical interface, and many users have forgotten or never heard of useful command line features. Windows is more than just point and click. The keyboard and command line can greatly complement the mouse with icons.

Cmd.exe - what is it?

The command line appears when you run cmd.exe. It is a MS Windows system process, as well as a command interpreter that supports file and network functions of a PC. Cmd.exe works by loading applications and transferring data between them. The process translates data entered into the system into a form that the operating system can understand. Cmd.exe operates a number of built-in commands that are executed in a command shell environment.

The latter is a program that provides direct communication between the user and the operating system. Used to create and edit scripts (batch files) for various purposes. For example, to manage user accounts. Using a command shell program makes it possible to automate some operations. This is much faster than using external programs. You can also customize the command line window to your taste and control the execution of tasks.

Command line call

The command line can be called by launching the application in the system directory System32\cmd.exe. What, is it difficult? There are other options:

  • Through the menu “Start - All Programs - Windows System - Command Prompt”.
  • Go to the Start menu, type cmd in the search box and launch Command Prompt.
  • Open the application launch window using the Win+R key combination, enter cmd and click the “Start” button.
  • Right-click on the Start menu to open a pop-up window and select the item you need. To run the application with administrator rights, select “Command Prompt (Administrator)”.
  • Right-clicking while holding down the Shift and Alt keys in the “File Explorer” will bring up where you need to select the “Open command window here” option. As a result, the command line will be launched in the selected directory.

To pin System 32\cmd.exe to the Start menu, you need to right-click on the program and select “Pin to Start Menu” from the context menu.

Configuration

The command window can be configured by right-clicking on its title and selecting “Default”. The selected configuration will be saved for subsequent cmd.exe sessions. To specify settings only for the current session, use the “Properties” item.

Here you can select the parameters of the font, size and location of the window, text color, background, transparency.

When you select the “Mouse selection” option, you can select text while holding down the left mouse button, and use the “Enter” key to copy it into

Command window colors can also be set by running Cmd.exe with the /t:fg parameter, where f sets the text color and g sets the background color as a hexadecimal digit from 0 to F: black (0), blue (1), green (2 ), sea green (3), red (4), violet (5), yellow (6), white (7) and their light shades in the same order with codes from 8 to F.

Cmd.exe keys: what are they?

When starting the command line, other switches are also used. The syntax for launching the Cmd.exe application is as follows:

cmd [[(/c|/k)] [(/a|/u)] line], where:

  • c executes the command specified by the string and exits the application;
  • k executes the command given by the string and continues the application;
  • s changes the interpretation of the line after the /c or /k switches;
  • q disables screen output;
  • a specifies the ANSI output;
  • u specifies output in Unicode;
  • t:fg sets the text and background color;
  • e:(on|off) enables and disables the use of the extended command set;
  • f: (on|off) enables or disables file or directory name completion;
  • v: (on|off) enables and disables lazy expansion of the environment variable written between!, during command execution;
  • “string” specifies the command to be executed;
  • /? displays help in the command window.

Several commands at once

In the command line specified as a parameter, you can specify two or more Cmd.exe commands. To do this, the string must be enclosed in quotes, and the commands must be separated using the character sequence &&.

The same command separator is used on the command line itself. Here it is called the AND operator: command_1 && command_2: if command_1 was executed successfully, then command_2 will be executed.

The command connection operator &: command_1 & command_2: command_2 will be executed after the command command_1.

OR operator: command_1 || command_2: command_2 will execute if command_1 fails.

Conveyor operator |: command_1 | command_2: data from the command_1 output is redirected to the command_2 input.

Commands are grouped using parentheses: (command_1 & command_2) || command_3: if command_1 and command_2 are not executed, then command_3 will be executed.

If multiple commands have more than one parameter, they are separated by commas or semicolons: command_1 parameter_1; parameter_2

Some other operators:

  • team > file redirects command output to a file, creating it or overwriting an existing one;
  • team >> file appends command output to an existing file or creates a new one;
  • team < file uses the contents of the file as command input;
  • @echo off is used in batch files to disable commands being written to the screen.

Hotkeys

When working with the command line, you can and should use hotkeys:

  • The ↓ / - button cycles through previously typed commands.
  • Backspace - erases the character to the left of the cursor.
  • Ctrl Home - erases a line to the left.
  • Ctrl End - erases a line to the right.
  • Ctrl ← - moves the cursor one word to the left (backward).
  • Ctrl → - moves the cursor one word to the right (forward).
  • Ctrl-C - interrupts the execution of the current command.
  • Esc - clears the command line.
  • F1 is equivalent to pressing the right arrow. Each press of it enters one character of the last command into the command line in order.
  • F2 - prints the last command up to the character pressed after
  • F3 - enters the last command in full.
  • F4 - will delete the command up to the character entered after pressing the function key.
  • F5 - equivalent to the up arrow, enters the last commands in turn.
  • F6 - responds to the Ctrl+Z key combination and inserts the end-of-file character EOF.
  • F7 - displays a window with a list of previously typed commands.
  • Alt+F7 - deletes command history.
  • F8 - equivalent to F5 with cyclic repetition. If F8 is pressed after entering the initial characters of a previously entered command, the program will fill it to the end.
  • F9 - inserts a command whose number in the command history corresponds to the number typed after the function key.
  • Insert - switches the insert/overwrite input mode.
  • Tab - automatically fills in the folder or file name, cycling through options with each subsequent press. Shift+Tab changes the direction of the search.

Internal and external teams

The console can use two types of commands - internal and external. Internal ones are built into the interpreter and can only be launched from the command line. External ones are launched as a separate executable file both from the console and from the “Start - Run” menu item. A list of them can be obtained using the help command. And more detailed information can be obtained by entering “help command” or “command /?”. For example, to get help about xcopy, you would type help xcopy or xcopy /?

Teams for everyone

Many console commands are focused on networking and administration, so they are often used by system administrators. But there are also cmd.exe commands that are available to the average PC user. Below are some of them.

1. Del /s folder\* - removes contents from the specified directory and all subfolders. Another switch /f will allow you to erase read-only files. If you are absolutely sure of this operation, adding the /q switch will eliminate the need to confirm each deletion. The command should be used with caution, since documents deleted in this way do not end up in the trash.

2. Mkdir (or md) can create an entire directory tree: md folder_1\folder_2\folder_3.

3. Xcopy opens up wide possibilities for regular and backup of large numbers of files. For example, the /d:[mm-dd-yyyy] key will allow you to operate only with documents modified after the specified date. The additional key /s will also allow you to copy subfolders. The team has a total of 27 keys.

4. rmdir (or similar rd) will help you delete the directory. In this case, the folders must be empty. The /s switch will allow you to get rid of subdirectories along with their contents. The additional switch /q is also possible.

5. Dir folder\*.doc /h /s > list.txt will create a file with a list of MS Word documents in the specified directory, including hidden files (thanks to the /h switch) and documents in subfolders (the /s switch).

6. You can change the file extension using the command ren *.txt *.doc.

7. Move /y folder_1\*.mp3 folder_2\ will move mp3 files from folder_1 to folder_2 without overwriting confirmation. Conversely, the /-y switch will prevent such overwriting.

8. Cmd.exe start. will open the current directory in Windows Explorer.

9. Cmd.exe start.. will open a folder in Windows Explorer one level higher than the current one.

10. The command System32\cmd.exe start shell:cookies will open the system folder with Internet cookies. For operating systems earlier than Windows 7, the Cmd.exe command is even simpler: start cookies.

11. Attrib -r -s -h file will remove the read-only, system, and hidden file marks.

12. Subst z: Folder will make the folder easier to access by giving it the name of the Z drive.

Batch file

In addition to the command line, Cmd.exe is capable of processing text documents with the extension .bat or .cmd, containing lines of commands executed one by one.

The batch file is capable of using arguments - user data transmitted in a certain form: %1, %2. At runtime, these parameters are replaced with user data.

The set /p variable= [string] command allows you to pass variable values ​​to a batch file. For example, set /p name= What is your name? creates a variable %name% with the value entered by the user.

Batch files can make decisions and select actions based on conditions:

  • If (condition) (command_1) Else (command_2) - if the condition is met, command_1 will be executed, otherwise _ command_2;
  • if exist file del file - the file will be deleted if it exists;
  • if not exist file echo file is missing - if the file is missing, the batch file will report this;
  • if /i line_1 gtr line_2 command - the command will be executed if line_2 is greater than line_1 without taking into account the case of characters (key /i).
  • goto:label allows you to go to the label, leaving some commands unexecuted.
  • for %%X in (*.jpg) do (command) - makes it possible to execute a command for all files with the extension .jpg.

Safely stopping the process

The Cmd.exe file is a system file. It is strongly recommended not to remove it or stop the processes running by it. They are very important for the correct operation of the computer. If the need to stop the process nevertheless arises, you need to do the following:

1. Go to the Start menu, type Msconfig in the search box and run the utility. A window will appear with a list of system configuration tools.

2. Select the StartUp tab and check if Cmd.exe is in the list.

3. Uncheck the box next to the process name, apply the changes and restart the computer.

4. After the reboot, uncheck the automatic launch of the system configurator when you turn on the PC.

Another way is to check the list of automatically started processes in the Registry Editor.

Cmd.exe can be stopped using the task manager in the processes tab. To do this, select the process and click on the “End Process” button.

Causes of errors

The Cmd.exe "Application Error" message is most often the result of corrupted operating system system files. Because of this failure, your computer's performance suffers. Also, problems in system processes arise due to incompatibility of applications, incomplete deletion of files, infection with computer viruses, incorrect operation of programs, etc. All this can lead to the deletion or corruption of important system files.

How to resolve Cmd.exe errors

One good thing about Cmd.exe errors is that this is a fixable problem. If one solution doesn’t help, then another will be found. Here are some of them.

  • Log in to the operating system with administrator rights.
  • Undo the last changes that caused the Cmd.exe "Application Error" message to appear. And if it appears while launching the same program, then remove or reinstall it.
  • Make sure you have reliable protection against viruses. You should scan your computer and eliminate unwanted programs.
  • One of the most common causes of this error is registry corruption. This is a ranked database that collects configuration information, email addresses, passwords, file paths and other information necessary for the normal operation of the PC. To correct the situation, you can use the Registry Cleaner utility's registry repair tool.
  • Update the video card driver from the manufacturer's official website.
  • Reinstallation of DirectX, NetFramework, Microsoft Visual C++ from the official Microsoft website.
  • Run the exe cmd command sfc /scannow as administrator. The system utility will scan your PC for errors and suggest ways to resolve them.

Many users are faced with a situation where, when starting the computer, a command prompt window appears and disappears indicating the source - C:\Windows\System32\cmd.exe. In especially severe cases, such a window can pop up constantly, which is quite annoying. Most often the window appears in Windows 10, less often in versions 7, 8. In the article we will explain in detail the reasons for this phenomenon and show how to remove this window.

What causes the cmd.exe line to appear?

The specific source of the appearance of the command line “C:\Windows\System32\cmd.exe” is an auto-run process, and it can be either a system service or a third-party application, or viral activity. It is necessary to distinguish between two situations in which such a window pops up:

  1. The moment Windows starts. The desktop loads, and then a line window appears. Most often this is due to some OS service running in the background. The more powerful your hardware, the faster cmd loads and disappears.
  2. The window appears constantly (periodically) during operation. In this case, you need to say that the background process is constantly “freezing”, cannot boot, or is blocked by the system.

I encountered exactly the first situation, my line appears for literally a few seconds and closes. It does not cause any discomfort.

Is this kind of autorun dangerous?

In most cases, the source is a system process and is absolutely harmless. The operating system, while loading and running, constantly activates thousands of background processes and hundreds of services. Imagine that the execution of one “heavy” service slows down, and if your CPU is weak, then the freezing time only increases. This is especially often observed on dozens, which are more demanding on hardware.

It's another matter when third-party software tries to execute its commands. And it’s even worse when virus activity in the background loads the computer.

How to remove the cmd.exe command line that opens?

In any case, to identify the source of the pop-up line, it is necessary to conduct a comprehensive cleaning and check of the Windows 7/8/10 settings. Here's what to do first:


These are all general tips - half measures, so to speak, that will help with minor failures and broken parameters. Otherwise, you will have to manually check everything.

Removing pop-up cmd.exe using Scheduler

To start, type “Task Scheduler” into the search menu or write in Perform operation – taskschd.msc. Afterwards the PZ menu will open, and we do the following:


After you remove/disable everything unnecessary, the command line should disappear. A similar procedure can be carried out by erasing run files in the registry - here is a visual video.

Conclusion

All of the above methods should fully solve the problem of the C:\Windows\System32\cmd.exe command line opening randomly. I repeat once again: if a window starts up and disappears when the system starts, this is normal and there is no need to worry. If you have any questions, or if you have a mistake somewhere else, write in the comments.