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

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_MACHINE\SOFTWARE\Microsoft\Command Processor registry subkey (to configure the prompt for everyone) or to the HKEY_CURRENT_USER\Software\Microsoft\Command 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.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.