• Run cmd as administrator: several simplest methods. Run command line (cmd) with administrator rights

    The command line is a universal tool in any operating system. Over time, many people come to the conclusion that they need to use this tool. This is usually necessary to solve some problem in the OS. Let's look at how to open the command line in Windows 7 as an administrator using all available methods.

    Administrator privileges when calling the utility are necessary so that the user can perform virtually any action in Windows, even though he is working under an account with limited privileges. In such a case, if the administrator account is protected by a password, you will have to enter it each time to call command line by any of the methods below.

    This is a software shell that transmits text commands entered into it to the operating system. Physically, it is a cmd.exe file, which is located in the “%windir%\system32” directory, and in Windows 7 x64 in the “%windir%\SysWOW64” directory.

    Although a lot of time has passed since the days of MS-DOS and many operations in Windows are performed through a graphical interface, no one is going to give up the command line. Firstly, not all actions in Windows 7 can be performed through the console, and secondly, it is much faster to enter a text command and press Enter than to perform numerous clicks on window elements, various menus and other graphic elements.

    Run window

    In addition to the console, text commands are sent to the operating system via command interpreter. Its features are:

    • the window with the result of the command is not displayed after its execution;
    • after launching each of them, the interpreter has to be called again;
    • Administrator privileges are required to run commands.
    1. We launch this tool using the button of the same name in “Start” or the key combination Win + R.

    1. Enter the command “cmd”, “cmd.exe” or the full path to the file into the text form: “%windir%\system32\cmd.exe” and execute the command.

    Here the question may arise: how do you know that the necessary privileges have been obtained? We turn our attention to the window header - there should be an inscription: “Administrator: path to the cmd.exe file.”

    Many people write: “I can’t start the console as an administrator.” This can happen if your account is not allowed to do this by the administrator, and only he can solve the problem.

    Shortcut in Start

    1. Open this drop-down menu and click “All Programs”.
    2. Scroll down and click on the “Standard” folder.
    3. Calling context menu shortcut and select the appropriate item.

    Search bar

    1. Let's expand on the main thing Windows menu 7 and enter part of the utility name into the search bar.
    2. As in the previous case, open the context menu of the target object that appeared as a result of the search and select “Run as...”.


    Second option: enter “cmd” into the search, hold down Ctrl + Shift + Enter and left-click on the icon.

    Create a shortcut

    If we launch the command line frequently, it would be advisable to create a shortcut on the desktop or in the “Taskbar” (drag it here from the desktop or pin it).

    1. Right-click on the free area and select the command to add a new shortcut.

    1. Set the location object to “cmd” and click “Next”.

    1. Enter its name and press Enter.

    1. Open the properties of an object using the combination Alt + Enter or the right button.

    1. Click "Advanced".

    1. In the advanced properties window, check the first option and click “OK”.

    1. We close all windows.

    To add a shortcut to the “Taskbar”, drag it to the desired area or when running utility Call the “Pin to Taskbar” command.

    A shortcut is also created by dragging the executable file onto the desktop or into the “Taskbar”.

    Conductor

    Open “Explorer” (go to any folder except “My Computer”).

    1. The fastest way to do this is with the key combination Win + E.
    2. Hold down Shift and open the context menu (right click) of the space free from files/directories.
    3. Click on the “Open command window” item.

    Direct call

    The command line can be started as normal applicationdouble click By executable file. Let's do this.

    1. We call up the “Explorer” window: we used the key combination Win + E for this.
    2. IN address bar enter “%windir%\system32”, and for 64 bit you can also “%windir%\SysWOW64”, find our file and execute it as administrator.

    Another fancy way

    1. Open the “Task Manager” Ctrl + Shift Esc.
    1. Click “File” -> “New task”.

    1. Enter the name of the utility and open it.

    The method is suitable for cases when the explorer.exe file is damaged or replaced by viruses.

    In the mass of author's assemblies operating system There is the ability to open the console with extended permissions through the context menu of directories. We use official version OS, so we won’t be able to demonstrate this.

    We have considered all opening options command console in Windows 7 with administrator privileges, which is necessary to execute most commands on the system. Without these rights, your ability to manage the Seven will be meager, and many problems simply cannot be solved without this.

    Video instructions

    In the selection of videos below you can see some of the methods in action: after all, it is easier for people to perceive information in visual rather than text form.

    Team CMD used to launch a new copy of the command Windows processor. As a rule, the need for such a launch arises in cases where it is necessary to override the current command line settings specified by the user profile and computer settings. Command line switches CMD override the values ​​specified by registry settings that determine the current settings of the Windows command interpreter.

    Command line format:

    CMD [line]

    Command line options:

    /C  Execute the specified command (line) and then terminate.

    /K  Execute the specified command (line) without subsequent completion.

    /S  Change of behavior after /C or /K (see below)

    /Q  Disable the mode for displaying commands on the screen (ECHO).

    /D  Disabling execution of AutoRun commands from the registry (see below)

    /A  Output the results of command execution in ANSI format.

    /U  Output the results of command execution in UNICODE format.

    /T:fg  Selecting foreground/background color (for more details, see COLOR /?)

    /E:ON  Enable advanced command processing (see below)

    /E:OFF  Prohibition of extended command processing (see below)

    /F:ON  Resolution of terminating characters in file and folder names (see below)

    /F:OFF  Prohibition of terminating characters in file and folder names (see below)

    /V:ON  Allow deferred expansion environment variables using the "!" as a separator. For example, /V:ON allows the use of!var! as a runtime expansion of var. The var syntax is used to expand variables on input, which produces very different results inside a FOR loop.

    /V:OFF  Prohibition of delayed expansion of environment variables.

    To specify multiple commands on one line, separate them with "&&" and enclose them in quotation marks. Additionally, for compatibility reasons, /X is the same as /E:ON, /Y is the same as /E:OFF, and /R is the same as /C. All other command line switches are ignored.

    If the /C or /K switches are specified, then the rest of the command line after that switch is treated as the command line, and quotation marks (") are processed according to the following rules:

    1. If all of the following conditions are met, the quote characters on the command line are preserved:
    - the /S key is missing
    - there are exactly two quote characters
    - there are no other special characters between them, such as: &()@^|
    - there are one or more spaces between them
    - the string enclosed in quotes is the name of the executable file.

    2. Otherwise, the first character is checked and if it is a quote character, it is removed, the last quote character on the command line is also removed, and all text after that last quote character is retained.

    If the /D switch is NOT SPECIFIED on the command line, then when CMD.EXE is launched, the values ​​of the REG_SZ or REG_EXPAND_SZ variables are checked for the following sections of the system registry:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

    And if one or both of them are present, then they are executed first.

    By default, enhanced command processing is enabled. To disable extended processing for a specific call, use the /E:OFF.

    You can enable or disable extended command processing for all calls to CMD.EXE on this computer or for a given user session by setting using REGEDIT.EXE in system registry meaning 0x1 or 0x0 for REG_DWORD parameters for the following sections:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

    User settings override computer settings. Command line options override the corresponding registry settings.

    IN batch file SETLOCAL ENABLEEXTENSIONS or DISABLEEXTENSIONS arguments override the /E:ON or /E:OFF option. For more information, enter "SETLOCAL /?".

    In advanced command processing, changes and/or additions affect the following commands:

    DEL or ERASE

    CD or CHDIR

    MD or MKDIR

    START (calling external commands has also been changed)

    For details, enter "command_name/?".

    Lazy environment variable expansion is NOT ENABLED by default. You can enable or disable delayed environment variable expansion for a specific call to CMD.EXE by using the /V:ON or /V:OFF option. You can enable or disable delayed environment variable expansion for all calls to CMD.EXE on a given computer or for given user by setting the value in the system registry using the REGEDIT.EXE command 0x1 or 0x0 for parameters REG_DWORD for the following sections:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion User settings override computer settings. Command line options, in turn, override registry settings.

    In a batch file, the SETLOCAL ENABLEDELAYEDEXPANSION or DISABLEDELAYEDEXPANSION arguments override the /V:ON or /V:OFF option. For more information, enter "SETLOCAL /?".

    If lazy environment variable expansion is enabled, the exclamation point character "!" can be used to replace the current value of an environment variable at run time.

    You can enable or disable file and folder name completion for a specific call to CMD.EXE using the /F:ON or /F:OFF switches. You can enable or disable name completion for all calls to CMD.EXE on a given computer or for a given user by using REGEDIT.EXE to set the REG_DWORD values ​​in the system registry for the following keys:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar

    And/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar

    Having installed them hexadecimal values equal to the control character code used for a particular function (for example, 0x4 for CTRL-D or 0x6 for CTRL-F). User settings override computer settings. Command line switches, in turn, override registry settings.

    If completion is enabled using the /F:ON command line switch, two control characters are used: CTRL-D for folder names and CTRL-F for file names. To disable a specific terminator in the registry, the hexadecimal value of the space character (0x20) is used as the special character code.

    Completion is called when one of these two special characters is entered. The completion function takes the path string to the left of the input point, appends a wildcard character to it if it doesn't have one, and then constructs a list of paths that match the resulting definition. The first element of this list of matching paths is then printed. If the list is empty, then beep and nothing is output. After this, re-entering the same special character will cycle through all matching paths. Keystroke Shift when entering a control character, allows you to view the list of paths in reverse order. If you change the output path and then enter the escape character again, the saved list is cleared and a new list of paths is built. The same thing happens if you switch from one completion symbol to another. The only difference when using the file terminator is that it takes both the path and the file name to build the match list, whereas when using the folder terminator, only the path is taken. When a folder terminator is used in one of the built-in folder manipulation commands (CD, MD, or RD), the folder terminator is always implied.

    The terminator also works correctly with file names containing spaces or other special characters, if the matching string is enclosed in quotes. Additionally, if you move the insertion point to the left and then use a trailing character within a line, the remaining text to the right of the insertion point will be discarded.

    Special characters that require quotation marks:

    space

    &(){}^=;!"+,`~

    Examples of use:

    cmd.exe /F:ON- launch a new command line window with the mode for using terminating characters in file and folder names enabled. This mode makes it easier to type names, for example, if you type the character “S” and press CTRL+D, then the directory name starting with “S” will be substituted, the next time you press CTRL-D – the name of the next alphabetical one, if one exists, For example:

    SAVED- on the first press.

    "System Volume Information"- when you press CTRL+D for the second time. If the name contains a space, it is enclosed in double quotes.

    To substitute file names, use the combination CTRL+F.

    The use of termination characters can be configured to be used permanently on a given computer, as described in this article.

    cmd.exe /U /C "C:\Program Files (x86)\FPinger\Collect.exe"- run the "Collect.exe" program in the mode of outputting results in UNICODE encoding and end.

    cmd.exe /A /K "C:\Program Files (x86)\FPinger\Collect.exe"- run the "Collect.exe" program in ANSI encoding mode and wait for user input.

    cmd /C /V:ON exanpfor.bat- execute batch file eamppfor.bat in the mode of allowing delayed expansion of environment variables using the "!" as a separator.

    cmd /T:f0- run the command processor in the mode of displaying black characters on a white background.

    Running Command Prompt as an administrator on Windows in elevated mode is not a difficult task. Some useful commands require execution with such privileges. If you open them in normal mode, then you will most likely see an error message.

    It is advisable to have administrative access to Windows or know the admin password. When you try to call cmd as a user with limited rights, then a UAC window will open. Here you must enter the administrator password in the form; if entered correctly, you will launch a command line with administrator capabilities.

    How can I find out what mode the console is open in? Look at the title of the window, if it says “Administrator”, then you have done everything correctly and can safely start writing commands.

    There are many ways to launch the console as an administrator, and they are almost identical in different Windows versions. All methods can be used equally.

    Open a command prompt with administrator privileges on Windows 7

    Familiarize yourself with the process and highlight for yourself convenient way cmd launch location For example, consider the shortcut:

    1. Click "start".

    2. Place “command line” in the search.

    3. Wait for the list to be built. Place the mouse cursor on the very first object and right-click.

    4. A menu will pop up, in it select the line “run as administrator”.

    5. If the User Account Control option is enabled, click yes.

    Note: Enter the admin password if you see an input field, and then click “yes”.

    Run cmd on Windows 8 with administrator rights

    1. Press the "start" button.

    2. Move to the right all the way.

    3. Click on the magnifying glass icon.

    4. In the form, enter cmd.

    5. Right-click on the “command line” object.

    6. In the menu, click Run as administrator, as in the screenshot.

    7. In the User Account Control window, click “yes”.

    Like all modern operating systems, XP also has this function. Follow the steps in the links and recommendations above.

    As you can see, there are not many steps you need to do to launch the command line as an administrator. With these rights, you can execute any written command in cmd. For example, this way you will have the opportunity to easily and quickly and more.

    Often a situation arises when you need to run cmd with administrator rights. However, this is not so easy to do for an untrained user. The whole problem is that by default, cmd is launched as the current user; to run as an administrator, you either need to log into the system under the admin username, or do some trick.

    There is a certain nuance that needs to be done before running the command line as an administrator. You need to check whether the administrator account is enabled, if it is enabled, assign a password to it. Now let's take a closer look.

    First, you need to check whether your administrator account is enabled. To do this, open “ Computer management

    go to the item “ Local users and groups” — “Users“. As you can see, in my case the account “ Administrator” is disabled (there is an arrow on the icon).

    Double click to open properties account and uncheck the “ Disable account

    Click “ OK“. The arrow from the admin account icon has disappeared, which means it is enabled. Now let's set a password. To do this, right-click on the account “ Administrator” and select the menu item “ Set password...

    On the password change warning, click “ Continue” and enter the password twice

    Ready! You now have an administrator account and know the password for it. Let's move on to the next stage.

    Launch CMD with administrator rights

    Open the command line by clicking “ Start” — “Execute“, or keyboard shortcut “ Win+R” and enter the command cmd. In the window that opens, write the following:

    runas /profile /user:mymachine\Administrator cmd

    (Where mymachine– this is the name of your computer)

    and press Enter. The Command Prompt will ask you for an administrator password, enter it and wait for Command Prompt to launch with administrator rights. Everything would be fine, but after entering I got an error:

    This error can appear in two cases. First - you entered wrong password. Second, I have never logged in under an administrator account (my version).

    You need to log out and log in as an administrator, that's what I did

    You can now log out and log in again using your account. Once you are logged in with your account, try running cmd again as an administrator.

    And voila! A second command prompt window opened under the administrator account. Now you can browse directories, and even run applications as an administrator.

    For most users, what the developers offer is enough to “communicate” with Windows OS GUI- it is simple and intuitive. But for some purposes that the average user rarely encounters, it is more convenient to use the command line. How to start the command line on Windows?

    First, let's figure out what the command line is. Command line (console) interface - text. The user enters certain commands from the keyboard, and the system executes them. The command line is used, for example, to trace the route to a website (server) or to check ping in case of Internet problems.

    In Windows NT OS (Windows 2000 and higher) it is used command interpreter cmd lines.exe, which replaced the outdated command.com interpreter that was used in systems Windows family 9x and MS-DOS. The interpreter translates the text command into a form understandable to the system. Launching a command prompt in Windows means running the cmd.exe application.

    To open the command prompt, you can use one of the following methods.

    Click on the “Start” button. In the menu that opens, select Run. In the window that opens, in the Open line, enter the name of the program cmd.exe and click on the OK button or press the Enter key on the keyboard. In order to open the Run window, you can also use the key combination Win + R (Win is the key with Windows logo in the bottom row of the keyboard).

    You can open the command line in a more “traditional” way by selecting it from the list installed programs. To do this, again click on the “Start” button, select the All programs item in the menu, in it - the Standard item, and from the list standard programs select the program we need - Command Line.

    But running the command prompt this way may prevent you from running certain commands. To achieve this, you need to run the command line as an administrator. To do this, we “get” to the command line using the previous method (Start - All Programs - Accessories), but click on the phrase Command Prompt not with the left mouse button, but with the right one. A context menu will open. In it, click on the item Run as administrator. A dialog box may appear: “Do you want to allow the following program to make changes on this computer?” Feel free to click “Yes”.

    In order not to perform the same manipulations every time you start the command line, you can configure automatic start on behalf of administrator. To do this, call the context menu in the same way as in the previous case, but instead of Run as administrator, select Properties. In the properties dialog box that opens, go to the Shortcut tab and click on the Advanced button. In the window that opens, check the box next to Run as administrator, click OK, and in the properties window click Apply and OK.

    Windows 7 includes extensible command line interface shell, Windows PowerShell . It can be used instead of the standard command line. Launching Windows PowerShell is as easy as running a regular command line (cmd.exe): Start - All Programs - Accessories - Windows PowerShell.

    By running the command line, you can see list of most frequently used commands. To do this, enter the help command and press the Enter key. A list of available commands will open. To get additional information about the command you are interested in, you need to enter help command_name, for example, help tree. If you need to get information about a specific utility, the utility_name /? construct will help, for example, ping /?.

    Command line - enough useful tool Windows, which can be useful in various situations. And the next time the provider's technical support representative asks you to open the command line and check the ping, you will not have the question “How to open the command line?”