Меню

Advanced windows command prompt

prompt

Changes the Cmd.exe command prompt, including displaying any text you want, such as the name of the current directory, the time and date, or the Microsoft Windows version number. If used without parameters, this command resets the command prompt to the default setting, which is the current drive letter and directory followed by the greater than symbol (>).

Syntax

Parameters

Specifies the text and information that you want to include in the command prompt. /? Displays help at the command prompt.

Remarks

The character combinations you can include instead of, or in addition to, one or more character strings in the text parameter:

Character Description
$q = (Equal sign)
$$ $ (Dollar sign)
$t Current time
$d Current date
$p Current drive and path
$v Windows version number
$n Current drive
$g > (Greater than sign)
$l | (Pipe symbol)
$_ ENTER-LINEFEED
$e ANSI escape code (code 27)
$h Backspace (to delete a character that has been written to the command line)
$a & (Ampersand)
$c ( (Left parenthesis)
$f ) (Right parenthesis)
$s Space

When command extensions are enabled the prompt command supports the following formatting characters:

Character Description
$+ Zero or more plus sign (+) characters, depending on the depth of the pushd directory stack (one character for each level pushed).
$m The remote name associated with the current drive letter or the empty string if current drive is not a network drive.

If you include the $p character in the text parameter, your disk is read after you enter each command (to determine the current drive and path). This can take extra time, especially for floppy disk drives.

Examples

To set a two-line command prompt with the current time and date on the first line and the greater than sign on the next line, type:

The prompt is changed as follows, where the date and time are current:

To set the command prompt to display as an arrow ( —> ), type:

To manually change the command prompt to the default setting (the current drive and path followed by the greater than sign), type:

prompt prompt

Изменяет Cmd.exe командной строки, включая отображение любого нужного текста, например имя текущего каталога, дату и время или номер версии Microsoft Windows. Changes the Cmd.exe command prompt, including displaying any text you want, such as the name of the current directory, the time and date, or the Microsoft Windows version number. При использовании без параметров эта команда сбрасывает командную строку до значения по умолчанию, которое представляет собой текущую букву диска и каталог, за которыми следует символ «больше чем» ( > ). If used without parameters, this command resets the command prompt to the default setting, which is the current drive letter and directory followed by the greater than symbol (>).

Синтаксис Syntax

Параметры Parameters

Параметр Parameter Описание Description
Задает текст и сведения, которые необходимо включить в командную строку. Specifies the text and information that you want to include in the command prompt.
/? /? Отображение справки в командной строке. Displays help at the command prompt.

Комментарии Remarks

Сочетания символов, которые можно включить вместо или в дополнение к одной или нескольким символьным строкам в текстовом параметре: The character combinations you can include instead of, or in addition to, one or more character strings in the text parameter:

Символ Character Описание Description
$q $q = (Знак равенства) = (Equal sign)
$$ $ (Знак доллара) $ (Dollar sign)
$t $t Текущее время Current time
$d $d Текущая дата Current date
$p $p Текущий диск и путь Current drive and path
$v $v Номер версии Windows Windows version number
$n $n Текущий диск Current drive
$g $g > (больше чем знак) > (Greater than sign)
$l $l
$b $b | (Символ вертикальной черты) | (Pipe symbol)
$ $ ВВОД-ПЕРЕВОД СТРОКИ ENTER-LINEFEED
$e $e Escape-код ANSI (код 27) ANSI escape code (code 27)
$h $h Backspace (для удаления символа, записанного в командную строку) Backspace (to delete a character that has been written to the command line)
$a $a & (амперсанд) & (Ampersand)
$c $c ((Левая круглая скобка) ( (Left parenthesis)
$f $f ) (Правая круглая скобка) ) (Right parenthesis)
$s $s Пробел Space

Если расширения команд включены, команда Prompt поддерживает следующие символы форматирования: When command extensions are enabled the prompt command supports the following formatting characters:

Символ Character Описание Description
$+ Ноль или более символов плюса ( + ) в зависимости от глубины стека pushd Directory (по одному символу для каждого уровня). Zero or more plus sign (+) characters, depending on the depth of the pushd directory stack (one character for each level pushed).
$m $m Удаленное имя, связанное с текущей буквой диска или пустой строкой, если текущий диск не является сетевым диском. The remote name associated with the current drive letter or the empty string if current drive is not a network drive.

Если включить $p символ в текстовый параметр, диск считывается после ввода каждой команды (для определения текущего диска и пути). If you include the $p character in the text parameter, your disk is read after you enter each command (to determine the current drive and path). Это может занять некоторое время, особенно для дисководов гибких дисков. This can take extra time, especially for floppy disk drives.

Примеры Examples

Чтобы установить в командной строке с двумя строками текущее время и дату в первой строке и знак «больше чем» на следующей строке, введите: To set a two-line command prompt with the current time and date on the first line and the greater than sign on the next line, type:

Запрос изменится следующим образом, где Дата и время будут актуальными: The prompt is changed as follows, where the date and time are current:

Чтобы настроить командную строку для вывода в виде стрелки ( —> ), введите: To set the command prompt to display as an arrow ( —> ), type:

Чтобы вручную изменить командную строку на значение по умолчанию (текущий диск и путь, за которым следует знак «больше чем»), введите: To manually change the command prompt to the default setting (the current drive and path followed by the greater than sign), type:

How to Open Command Prompt

Open Command Prompt to Execute Commands in Windows 10, 8, 7, Vista, & XP

Some popular Command Prompt commands you might have heard of include ping, netstat, tracert, shutdown, and attrib, but there are many more. We have a complete list here.

While Command Prompt probably isn’t a tool most of you will use on a regular basis, it can really come in handy now and then, maybe to troubleshoot a specific Windows problem or to automate some kind of task.

How you open Command Prompt differs between Windows versions, so you’ll find steps below for Windows 10, Windows 8 or Windows 8.1, and Windows 7, Windows Vista, and Windows XP. See What Version of Windows Do I Have? if you’re not sure.

Open Command Prompt in Windows 10

Select the Start button.

Type cmd.

Select Command Prompt from the list.

Open Command Prompt Through the Start Menu

Another way to open Command Prompt in Windows 10 is to look in its Start menu folder:

Select the Start button.

Select the Windows System folder from the list.

Choose Command Prompt from the folder group.

Open Command Prompt Using Power User Menu

One more method in Windows 10 is through the Power User Menu. If you’re using a keyboard or mouse, choose Command Prompt from the menu that appears after pressing Win+X or right-clicking the Start button.

You might see Windows PowerShell options in the Power User Menu instead of Command Prompt. In more recent versions of Windows 10, Command Prompt has been replaced by PowerShell, but you can still access it from the Power User Menu by editing the taskbar settings.

Open Command Prompt in Windows 8 or 8.1

Select the Start button and then swipe up to show the Apps screen. You can accomplish the same thing with a mouse by selecting the down arrow icon at the bottom of the screen.

Prior to the Windows 8.1 update, the Apps screen can be accessed from the Start screen by swiping up from the bottom of the screen, or right-clicking anywhere, and then choosing All apps.

If you’re using a keyboard or mouse, a really quick way to open a Command Prompt window in Windows 8 is through the Power User Menu—just hold the WIN and X keys down together, or right-click the Start button, and choose Command Prompt.

Swipe or scroll to the right on the Apps screen to locate the Windows System section heading.

Select Command Prompt. You can now execute whatever command you needed to run.

See our List of Windows 8 Command Prompt Commands for a complete list of the commands available through Command Prompt in Windows 8, including short descriptions and links to more in-depth information if we have it.

Open Command Prompt in Windows 7, Vista, or XP

Open the Start menu from the bottom-left corner of the screen.

In Windows 7 and Windows Vista, it’s a bit faster to enter command in the search box at the bottom of the Start menu and then choose Command Prompt when it appears in the results.

Go to All Programs > Accessories.

Choose Command Prompt from the list of programs.

Here’s our List of Windows 7 Commands and List of Windows XP Commands if you need a command reference for any of those versions of Windows.

Other Ways to Open Command Prompt

Command Prompt in Windows XP through Windows 10 can also be opened with a command. This is especially helpful if you like using the Run dialog box or if Windows Explorer has crashed and the Start menu is inaccessible (and thus the directions above don’t work).

To do this, enter cmd into the command-line interface. This can be in the Run dialog box (WIN+R) or Task Manager’s File > Run new task menu.

Elevated Command Prompts and Old Windows Versions

In versions of Windows released before Windows XP, like Windows 98 and Windows 95, Command Prompt doesn’t exist. However, the older and very similar MS-DOS Prompt does. This program is located in the Start menu and can be opened with the command run command.

Some commands, like the sfc command that’s used to repair Windows files, require that Command Prompt be opened as an administrator before they can be executed. You’ll know if this is the case if you get a message like one of these after trying to execute the command:

  • check that you have administrative rights
  • . command can only be executed from an elevated command prompt
  • you must be an administrator

See How to Open an Elevated Command Prompt for help starting Command Prompt as an administrator, a process that’s a bit more complicated than what’s outlined above.

Advanced Command Prompt or CMD Tricks for Windows 10

If you have been a Windows user for a long time, I am sure you must have used Command Prompt. Even today, the CMD helps in performing many advanced administrative functions, and in troubleshooting Windows related issues. We have earlier, already covered some Basic Command Prompt Tips. Today we will see some a-bit-more-advanced CMD tricks for Windows 10/8/7.

Command Prompt or CMD Tricks

Copying Error Commands to Clipboard Directly

Many times while performing an operation you get an error. So, you might feel the need for copying and pasting the error to the clipboard before reporting it to the concerned authorities via email or chatting. Well, with this trick you can easily store a command output to a clipboard.

To do this, launch Command Prompt and simply add the command | clip at the end of the command. For e.g. Dir /d | clip.

Finding your IP address, DNS Server address, and a lot more

CMD lets you find out your IP address. To do this:

  • Type ipconfig /all at the command prompt and press Enter.
  • Once done, the command prompt will return you information on IP address and DNS servers along with information on your hostname, node type, primary DNS suffix, etc.

Also, CMD will let you know whether IP Routing, Wins Proxy, and DHCP are enabled or not.

Check if anyone is stealing your Wifi connection

One highlight of the command prompt is that it can even let you know if someone is having unauthorized access to your Local Area Connection and using it. To check, follow these steps:

  • Open your web browser and visit http://192.168.1.1 or http://192.168.0.1 or the default IP address for your broadband router.
  • Search for the tab mentioning ‘Attached Devices’ or something similar.
  • Then, find the computer name, IP address, and MAC Address or Physical Address or Hardware Address, of your computer. Use the above trick.
  • Next, compare it with those displayed by your router in Step 2. If you notice some strange devices, then there is a possibility that your neighbor is sharing the internet connection without your consent. Set a password!

Know if someone is hacking your computer/Trace a Hacker

You can even know if someone is hacking your computer.

  • Execute the netstat -a command and it will return you a list of computers that your computer is connected to.
  • In the results returned, you will find the Proto column giving details on the type of data transmission taking place (TCP or UDP), Local address column giving information on the port with which your computer is connected to an external computer. In addition to this, you will also notice ‘State’ providing you information on the state of the connection (whether a connection is actually established, or waiting for transmission or is “Timed Out”).
  • Thus, it will be easier for you to determine if someone you don’t know is actually connected to your computer or not.

Copy-Paste in Command Prompt

If you have been looking for a new method to copy-paste rather than the conventional one of using the option from the right-click context menu, try this!

  • Right-click on the command Prompt title bar of the window and chose ‘Properties’
  • Then, in the Properties window under the ‘Option’ table enable the ‘Quick Edit Mode’ option. That’s it!
  • Now, you just need to select text string/strings by moving the cursor over it, press the ‘Enter’ key to copy the selected texts to Clipboard and do a left-click to paste it there.

Open the Command Prompt from Any Location

It can be really annoying to execute the cd/chdir command over and over again to get to the right directory you want to work from. With the trick mentioned below, you could open a Command Prompt window from any folder you’re viewing, in Windows. To do this:

  • Open the folder in Windows Explorer and hold the Shift key while making a right-click on the folder.
  • Then, select ‘Run command window here’ to open the CMD prompt.
  • Click on the option and you’ll begin a new instance of the Command Prompt, ready and waiting at the right location!

Run multiple commands

You can run multiple commands by separating them with &&. This, however, is subjected to one condition!

  • The command towards the left should be executed first
  • Once it completes successfully then the second command can be made to run. If the first command fails, then the second command will not run.

Show folder structure

Use the following syntax to show the folder tree structure

Drag and Drop files or folders in CMD window to enter path

To get the full path of the file or folder auto-entered into your command prompt window, simply drag and drop the file or folder into the window. This will not work in an elevated CMD window.

Let us know if you have any other CMD tricks up your sleeve!

Читайте также:  Windows удаленный перезапуск служб
Adblock
detector