How can I configure my command prompt to display the machine name?

John Savill

January 27, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. If you connect to multiple computers (e.g., by Telnet), you can configure the command prompt to display the name of the computer you're connected to. The best way to do this is to configure the command processor to automatically run a prompt command at startup to evaluate the %computername% environment variable. To configure the prompt, perform the following steps:

  1. Start a registry editor (e.g., regedit.exe).

  2. Navigate to the HKEY_LOCAL_MACHINESOFTWAREMicrosoftCommand Processor registry subkey (to configure the prompt for everyone) or to the HKEY_CURRENT_USERSoftwareMicrosoftCommand Processor registry subkey (to configure the prompt only for the current user).

  3. From the Edit menu, select New, String Value.

  4. Enter a name of AutoRun, then press Enter.

  5. Double-click the new value, set it to "prompt [%computername%]$S$P$G" (don't type the quotes), then press Enter.

  6. Close the registry editor.

The change takes effect immediately. Your command prompt will now look like

[thunder] c:documents>

where "thunder" is the computer name. The registry setting passes the prompt command when each command session starts. The $S inserts a space, the $P specifies the drive and path, and the $G inserts the greater than (>) symbol. For other options, go to the command prompt and type

prompt /?

to view the Help menu.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like