CMD - launches a new copy of the Windows command interpreter. Running the Command Prompt on Windows

    Team RunAS used to run an application under a user account whose name is passed as a command line parameter. In Windows 7 and later, this command, with standard security settings, does not allow you to gain administrative privileges, as happens in the "Run as Administrator" mode. To run the application as an administrator, you will need to perform some system settings. A universal way to run applications and batch files as an administrator without prompting UAC using the standard Task Scheduler is described in the article

RUNAS command line format:

RUNAS [ ] /user: username program

RUNAS [ ] /smartcard program

RUNAS /trustlevel: program trust level

Command line options:

/noprofile- Do not load user profile. This results in faster app loading times, but may cause some apps to not function properly.

/profile- Load user profile. This option is set by default.

/env- Use current environment settings.

/netonly- Credentials are for remote access only.

/savecred- Use credentials saved by the user. This option is not available in Windows 7 Home or Windows 7 Starter editions and will be ignored.

/smartcard- A smart card is used to provide credentials.

/user- username must be in the form USER@DOMAIN or DOMAIN\USER

/showtrustlevels- Display a list of trust levels that can be used as arguments to the /trustlevel parameter.

/trustlevel- The value "trust level" must be listed in the list of trust levels.

program- Command line for EXE. See examples below.

Examples:

runas /user:mymachine\administrator cmd.exe- run the command interpreter cmd.exe as the user "administrator" of the computer "mymachine". When executing the command, you will be prompted for the password of the user on whose behalf the task should be executed.

runas /noprofile /env /user:mydomain\admin " mmc %windir%\system32\diskmgmt.msc "- launch the mmc console with the Disk Management snap-in as the user "admin" in the domain "mydomain". The user profile is not loaded and the current environment variables are used. Loading a user profile is only necessary when there will be a task running that requires any data from it. If the "/env" parameter is specified, then environment variables are inherited from the current user's environment.

runas /savecred /user:admin@mydomain regedit.exe- run the registry editor "regedit.exe" as the user "admin" of the domain "mydomain" and remember the entered password. If the "/savecred" parameter is present, the entered password is stored in the registry in encrypted form and will not be requested in the future.

runas /showtrustlevel- display the levels of trust that exist in the system. The response will display a list like:

The following levels of trust are available in the system:
0x20000 (Regular user)

In addition to the trustlevel value equal to 0x20000 you can use the values 0x10000, corresponding to the minimum set of privileges and 0x40000, the standard set for this user. To view the differences between different trust levels, you can use the command Whoami, executing it in a shell session launched with each of the levels trustlevel

runas /trustlevel:0x20000 cmd.exe- run cmd.exe command processor using the trust level obtained in the previous example.

runas /trustlevel:0x40000 cmd.exe- run cmd.exe command processor using the standard trust level.

Note: In a command line session started using the /trustlevel parameter, the list of privileges corresponding to each trust level can be obtained using the command whoami/priv, and full account information is whoami/ALL

Note: parameter /profile incompatible with parameter /netonly.

Note: parameter /savecred incompatible with parameter /smartcard.

To run applications as administrator using runas.exe you need to change the default system security settings:

Enable the Administrator account (by default, it is disabled);

Set a password for the user Administrator;

To check for administrator rights, a batch file named who-admin.bat the following content:

WHOAMI/PRIV | find /i "SeRemoteShutdownPrivilege"

If %ERRORLEVEL% == 0 goto admin

Echo NOT have admin rights!

ECHO!!! ADMIN!!!

The principle of privilege analysis is based on the use of the command whoami with parameter /priv. Depending on whether you have administrator rights, the batch file displays the message “NOT have admin rights!”, or “!!! ADMIN !!!” and waits for a key to be pressed on the keyboard. Details can be found in the team description. whoami follow the link from the full list of commands.

runas /savecred /user:Administrator C:\scripts\who-amdmin.bat- run the batch file as administrator who-amdmin.bat, located in the C:\scripts folder. At the first launch, you will be prompted for the Administrator password, at subsequent launches (with the parameter /savecred) - no password required.

Passwords that are remembered when using the RUNAS.EXE utility with the /savecred parameter can be changed or deleted using the Saved Password Management snap-in:

%systemroot%\system32\rundll32.exe" keymgr.dll,KRShowKeyMgr

When typing key values, you must respect the case of characters.

To manage saved accounts in the Windows command line, use the utility CMDKEY.EXE

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 normally, 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 versions of Windows. All methods can be used equally.

Open a command prompt with administrator privileges on Windows 7

Familiarize yourself with the process and choose for yourself a convenient way to launch cmd. 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.

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 the command line using 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 also sent to the operating system through the 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. Call the shortcut context menu and select the appropriate item.

Search bar

  1. Expand the main menu of Windows 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 the utility is running, 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 launched as a normal application - by double-clicking on the executable file. Let's do this.

  1. We call up the “Explorer” window: we used the key combination Win + E for this.
  2. In the address bar we enter “%windir%\system32”, and for 64 bit you can also “%windir%\SysWOW64”, we 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.

Most proprietary builds of the operating system include the ability to open a console with extended permissions through the directory context menu. We use the official version of the OS, so we won’t be able to demonstrate this.

We've looked at all the options for opening the Command Shell in Windows 7 with administrator privileges, which is necessary to run 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 instruction

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.

By entering commands in "Command line" in operating systems of the Windows family, you can solve a variety of problems, including those that cannot be solved through a graphical interface or are much more difficult to do. Let's see how you can open this tool in Windows 7 in different ways.

Interface "Command line" is an application that provides communication between the user and the OS in text form. The executable file of this program is CMD.EXE. In Windows 7, there are quite a few ways to call the specified tool. Let's find out more about them.

Method 1: Run window

One of the most popular and easiest ways to call "Command line" is to use a window "Run".


The main disadvantages of this method are that not all users are accustomed to remembering various combinations of hot keys and launch commands, as well as the fact that activation cannot be performed in this way on behalf of the administrator.

Method 2: Start Menu

Both of these problems are solved by running through the menu "Start". Using this method, it is not necessary to keep various combinations and commands in mind, and you can also launch the program of interest to us on behalf of the administrator.


Method 3: Use Search

The application we need, including on behalf of the administrator, can also be activated using search.


Method 4: Directly Run the Executable File

As you remember, we talked about launching the interface "Command line" is performed using the executable file CMD.EXE. From this we can conclude that it is possible to launch the program by activating this file by going to the directory of its location using Windows Explorer.


At the same time, it is not at all necessary to use the address bar to go to the directory where CMD.EXE is located in Explorer. Moving can also be done using the navigation menu located in Windows 7 on the left side of the window, but, of course, taking into account the address that was indicated above.

Method 5: Explorer Address Bar


Thus, you don’t even have to look for CMD.EXE in Explorer. But the main drawback is that this method does not provide for activation on behalf of the administrator.

Method 6: Run for a specific folder

There is a rather interesting activation option "Command line" for a specific folder, but, unfortunately, most users do not know about it.


Method 7: creating a shortcut

There is an option to activate the “Command Prompt” by first creating a shortcut on the desktop that links to CMD.EXE.

  1. Click RMB anywhere on your desktop. In the contextual list, select "Create". In the additional list, go to "Label".
  2. The shortcut creation window opens. Click on the button "Review…" to specify the path to the executable file.
  3. A small window opens, where you should go to the directory where CMD.EXE is located at the address that was already specified earlier. You need to select CMD.EXE and click "OK".
  4. Once the item's address is displayed in the shortcut creation window, click "Further".
  5. In the field of the next window, a name is assigned to the shortcut. By default, it corresponds to the name of the selected file, that is, in our case "cmd.exe". This name can be left as it is, but you can change it by entering any other name. The main thing is that by looking at this name, you understand what exactly this shortcut is responsible for launching. For example, you can enter the expression "Command line". After the name is entered, click "Ready".
  6. The shortcut will be generated and displayed on the desktop. To launch the tool, just double-click on it LMB.

    If you want to activate as an administrator, you should click on the shortcut RMB and select from the list "Run as administrator".

    As you can see, to activate "Command line" using a shortcut you will have to tinker a little once, but in the future, when the shortcut has already been created, this option for activating the CMD.EXE file will be the fastest and easiest of all the above methods. At the same time, it will allow you to run the tool both in normal mode and as an administrator.

There are quite a few launch options "Command line" in Windows 7. Some of them support activation as an administrator, while others do not. In addition, it is possible to run this tool for a specific folder. The best option to always be able to quickly launch CMD.EXE, including as an administrator, is to create a shortcut on the desktop.

Most users of the Windows operating system are accustomed to launching the desired application or game by double-clicking on a shortcut located on the desktop or by finding it in Start. Alternatively, you can open the folder in which it is installed and run the exe file from there.

Since launching applications this way may not always be suitable, in this article let's look at several different methods that can be used to launch a program from the command line.

Method 1: launch the system application

In order to launch one of the system applications from the console, use the “start” command and indicate the desired name separated by a space. You need to enter the system name as the name. For Explorer - this is explorer, task manager - taskmgr, control panel - control, system configuration - msconfig.

To open a notepad, write notepad, Windows Media Player - wmplayer, Paint - mspaint, character table - charmap. If you type cmd , a new command prompt window will open.

For example, let's open the symbol table. Type in the line:

and press "Enter".

Method 2: specifying the full path to the file

If you need to run any other installed application, then you should specify the full path to the program's executable file.

For example, in my Downloads folder there is a program for installing Film Studio, let's open it. I go into the folder and click on the field where the path is written. This entire line needs to be written on the command line (since copy-paste does not work there) and at the end add the name of the utility that we want to run.

The console will write:

c:\users\master\downloads\wlsetup-all

After pressing “Enter”, preparations for installing the Film Studio began. As you can see, when writing the path it is not necessary to use capital letters; you can only enter small ones.

If there are spaces in the path to the desired file, then a window will appear with a message that the specified file cannot be found. The thing is that the command line recognizes the path up to the first space, and not the entire line you entered. In the example, it decided that I wanted to open c:\program .

Now let's move a little away from the topic and look at how to find out the full path to the program that we want to run.

To do this, find the executable file of the desired application through the Explorer window. To understand that this is it, make sure that “Application” is indicated opposite it in the “Type” field. Then click on the field at the top - this is the path.

For example, Total Commander is launched by the file “totalcmd”, and it is located along the path: "c:\program files\total commander".

Or another option. If there is a shortcut to the desired application on the desktop, you don’t have to search for it through Explorer. Just right-click on it and select "File location".

The window we have already looked at will open. It will highlight the file that launches the utility, and at the top you can find out the path to it.

Method 3: using path

Using this command, we will save the path to the folder in which the executable file is located, and then run it.

Let's consider the same Total Commander. In the console we write:

path c:\program files\total commander

Be sure to include a space after “path”. It is along this path that the “totalcmd” file we need is located. Press "Enter".

The specified program will be launched. It is not necessary to specify the extension at the end. Thus, you can run any executable file in the specified folder.

Method 4: using the cd command

This command will open the specified folder, and from it we will launch the file we need. For example, let's go to the TeamViewer folder:

cd c:\program files\teamviewer

After "cd" put a space. Press "Enter".

This folder contains the file that launches TeamViewer; it has the same name. So next I enter:

I press “Enter” and the utility starts.

If you need to open an application that is not installed on the system drive, you can use the path command. If I type:

path d:\program files\ccleaner

(after entering each line, press “Enter”), then CCleaner will open. It is installed in the specified path on drive D:.

But this cannot be done using the cd command.

Method 5: through the context menu

To do this, find the folder in which the executable file is stored and right-click on it, while holding down the Shift key. Next, in the context menu, select "Open command window".

After this, the folder we need will immediately open in the command line. Enter in the line the name of the file that launches the utility and press Enter. We launched CCleaner, which is not located on the system drive (I have D:).

If you need to run a program that is installed in the same place as the operating system, the steps are the same. Let's open the Google Chrome browser. We find the folder in which the file is stored that launches it, and select the item mentioned above.

Then enter the name of the file with the extension .*exe: chrome, and press “Enter”. The browser will be launched.

Method 6: path in quotes

At the beginning, I mentioned that if there are spaces in the specified path, the file will not open. But if you write it in quotes, the console will understand everything. Quotes must be double and straight, not commas. They are installed using the combination “Shift + E” with the selected English keyboard layout.

In them you need to write the full path and at the end indicate the file itself with the extension that will be launched:

"c:\program files\total commander\totalcmd.exe"