How to change the prompt.
Issue:
How to change the prompt.Reasoning:
A user may want to change his or her prompt to get additional information listed while navigating through their session.Solution:
Microsoft DOS users
To change the prompt in MS-DOS you must utilize the prompt command followed by special codes used in conjunction with the prompt command. Below are some commonly used prompts.
prompt $p$g
Changes the prompt to the standard used prompt in MS-DOS listing the drive with the current path, similar to what is seen below.
C:\>
C:\>
prompt $t $d$_$p$g
Change the prompt to list the time and date above the standard prompt, similar to what is seen below.
13:38:49.78 Mon 02/17/2003
C:\>
13:38:49.78 Mon 02/17/2003
C:\>
If you wish to make these changes permanent, edit the autoexec.bat and add the prompt line you used at the prompt.
Unix / Linux users
Changing the prompt in Unix / Linux varies depending on what shell you are using.
If you are using the C Shell, type:
set prompt="`hostname`>"
Displays the hostname in the prompt, similar to the below prompt:
ComputerHope>
ComputerHope>
set prompt="`pwd`>"
Displays the working directory with the prompt:
/root>
/root>
set prompt="`hostname`(`pwd`)>"
Displays the hostname along with the working directory:
ComputerHope(/root)>
ComputerHope(/root)>
set prompt=\[`id -nu`@`hostname -s`\]\#\
Displays the user who is logged in along with the hostname, similar to the below prompt:
[root@computerhope]#
[root@computerhope]#
If you wish to make the prompt permanent in the C Shell, edit the .cshrc file and add the same line you used at the prompt.
Additional information:
- Additional information on the MS-DOS prompt command can be found on our prompt command help page.
In DOS, how can I modify my prompt or the screen color?
Note: The software discussed here is no longer in common use at Indiana University, and UITS may no longer be able to verify the document's accuracy. The UITS Support Center may no longer have the manuals and other materials required to support this software adequately.You can use the prompt command to personalize the DOS prompt. The format of the command is: prompt text where
text
is a line of text that specifies the format of the prompt. Changing Prompt Information
Place the following special codes in the text string to produce special information or characters:Code | Result |
---|---|
$_ | Enter/Linefeed |
$$ | Dollar sign |
$b | | (pipe) |
$d | Current date |
$e | ASCII escape code (code 27) |
$g | > (greater-than sign) |
$h | Backspace |
$l | < (less-than sign) |
$n | Current drive |
$p | Current drive and path |
$q | = (equal sign) |
$t | Current time |
$v | DOS version number |
prompt
command is:prompt $p$g This produces a prompt that consists of the current drive and path followed by a greater-than sign. Once you have found a prompt that you like, you should include the
prompt
command that produces it as an entry in your AUTOEXEC.BAT
file, located in the root directory.Changing Colors
If you wish to produce text of different colors, you will need to install the ANSI screen driver. Make sure that the fileANSI.SYS
exists on your hard drive and is correctly referenced in an entry in your CONFIG.SYS
file, similar to the following: DEVICE = C:\DOS\ANSI.SYS The above example assumes that the ANSI.SYS
file is located in your DOS
directory on the C:
drive. Replace the drive letter and/or path information as necessary on your own computer.Note:
ANSI.SYS
replacements such as NANSI.SYS
or FCONSOLE.DEV
may also work, but may be incompatible with some software.You can change the colors of the text in the DOS prompt (and the color attributes of the screen) using the following escape sequence: $e[xx;yy;zzm where
xx
= attribute code, yy
= foreground color code, and zz
= background color code. A table of the color codes follows:
Code | Color |
---|---|
0 | Turn Off Attributes |
1 | High Intensity |
2 | Normal Intensity |
4 | Underline (mono only) |
5 | Blink |
7 | Reverse Video |
8 | Invisible |
30 | Black |
31 | Red |
32 | Green |
33 | Yellow |
34 | Blue |
35 | Magenta |
36 | Cyan |
37 | White |
40 | Black |
41 | Red |
42 | Green |
43 | Yellow |
44 | Blue |
45 | Magenta |
46 | Cyan |
47 | White |
C:\>
prompt and bright yellow text on a blue background.C:\> prompt $e[1;31;44m$p$g$e[1;33;44m Including color specifications in the prompt command changes not only the color of the prompt, but also the color of other text that you type or display. In the above example, the prompt will appear red, but other text will show up as yellow on blue.
Sample Prompts
For some interesting prompts, cut and paste as entries in yourAUTOEXEC.BAT
file one of the following command lines that begin with the prompt command: GO IU!:
prompt $e[5;37GOm$e[5;31mIU$e[0;33m$p$gMerry Christmas:
prompt $e[1;5;37m *$_$e[0;32;40m 1$_ $e[1;31;42m u $_$e[33;42m x o $e[30;40m$e[K$_ _$_$e[31m MERRY$_CHRISTMAS!$_$e[37m$p$gJack o' Lantern:
prompt $e[1;32;40m Z$_$e[33;43m $e[40m$e[K$_$e[43m $_ __ $e[37;40m$e[37;40m$e[K$_ BOO!$_$_$e[35m $p$g$e[37mChoo choo train:
prompt $e[44;37;5m$e[16C$e[0;44;1;31m$_111$e[36m111$e[31m111$e[3 5m11 1\]$_$e[32;5mx x x x x x x$e[0;1;44;37m$e[1A$p$gMS-DOS and command line overview
Below is a listing of each of the MS-DOS commands currently listed on Computer Hope and a brief explanation of what each of the commands do. The below commands are all MS-DOS commands, which means not all the below commands will work in your version of MS-DOS and/or Windows command line. Clicking on the command will open the help page for that command with full details about it.Command | Description | Type |
ansi.sys | Defines functions that change display graphics, control cursor movement, and reassign keys. | File |
append | Causes MS-DOS to look in other directories when editing a file or running a command. | External |
arp | Displays, adds, and removes arp information from network devices. | External |
assign | Assign a drive letter to an alternate letter. | External |
assoc | View the file associations. | Internal |
at | Schedule a time to execute commands or programs. | External |
atmadm | Lists connections and addresses seen by Windows ATM call manager. | Internal |
attrib | Display and change file attributes. | External |
batch | Recovery console command that executes a series of commands in a file. | Recovery |
bootcfg | Recovery console command that allows a user to view, modify, and rebuild the boot.ini | Recovery |
break | Enable / disable CTRL + C feature. | Internal |
cacls | View and modify file ACL's. | External |
call | Calls a batch file from another batch file. | Internal |
cd | Changes directories. | Internal |
chcp | Supplement the International keyboard and character set information. | External |
chdir | Changes directories. | Internal |
chdsk | Check the hard disk drive running FAT for errors. | External |
chkntfs | Check the hard disk drive running NTFS for errors. | External |
choice | Specify a listing of multiple options within a batch file. | External |
cls | Clears the screen. | Internal |
cmd | Opens the command interpreter. | |
color | Easily change the foreground and background color of the MS-DOS window. | Internal |
command | Opens the command interpreter. | |
comp | Compares files. | External |
compact | Compresses and uncompress files. | External |
control | Open Control Panel icons from the MS-DOS prompt. | External |
convert | Convert FAT to NTFS. | External |
copy | Copy one or more files to an alternate location. | Internal |
ctty | Change the computers input/output devices. | Internal |
date | View or change the systems date. | Internal |
debug | Debug utility to create assembly programs to modify hardware settings. | External |
defrag | Re-arrange the hard disk drive to help with loading programs. | External |
del | Deletes one or more files. | Internal |
delete | Recovery console command that deletes a file. | Internal |
deltree | Deletes one or more files and/or directories. | External |
dir | List the contents of one or more directory. | Internal |
disable | Recovery console command that disables Windows system services or drivers. | Recovery |
diskcomp | Compare a disk with another disk. | External |
diskcopy | Copy the contents of one disk and place them on another disk. | External |
doskey | Command to view and execute commands that have been run in the past. | External |
dosshell | A GUI to help with early MS-DOS users. | External |
drivparm | Enables overwrite of original device drivers. | Internal |
echo | Displays messages and enables and disables echo. | Internal |
edit | View and edit files. | External |
edlin | View and edit files. | External |
emm386 | Load extended Memory Manager. | External |
ename | Recovery console command to enable a disable service or driver. | Recovery |
endlocal | Stops the localization of the environment changes enabled by the setlocal command. | Internal |
erase | Erase files from computer. | Internal |
exit | Exit from the command interpreter. | Internal |
expand | Expand a Microsoft Windows file back to it's original format. | External |
extract | Extract files from the Microsoft Windows cabinets. | External |
fasthelp | Displays a listing of MS-DOS commands and information about them. | External |
fc | Compare files. | External |
fdisk | Utility used to create partitions on the hard disk drive. | External |
find | Search for text within a file. | External |
findstr | Searches for a string of text within a file. | External |
fixboot | Writes a new boot sector. | Recovery |
fixmbr | Writes a new boot record to a disk drive. | Recovery |
for | Boolean used in batch files. | Internal |
format | Command to erase and prepare a disk drive. | External |
ftp | Command to connect and operate on a FTP server. | External |
ftype | Displays or modifies file types used in file extension associations. | Recovery |
goto | Moves a batch file to a specific label or location. | Internal |
graftabl | Show extended characters in graphics mode. | External |
help | Display a listing of commands and brief explanation. | External |
if | Allows for batch files to perform conditional processing. | Internal |
ifshlp.sys | 32-bit file manager. | External |
ipconfig | Network command to view network adapter settings and assigned values. | External |
keyb | Change layout of keyboard. | External |
label | Change the label of a disk drive. | External |
lh | Load a device driver in to high memory. | Internal |
listsvc | Recovery console command that displays the services and drivers. | Recovery |
loadfix | Load a program above the first 64k. | External |
loadhigh | Load a device driver in to high memory. | Internal |
lock | Lock the hard disk drive. | Internal |
logoff | Logoff the currently profile using the computer. | External |
logon | Recovery console command to list installations and enable administrator login. | Recovery |
map | Displays the device name of a drive. | Recovery |
md | Command to create a new directory. | Internal |
mem | Display memory on system. | External |
mkdir | Command to create a new directory. | Internal |
mode | Modify the port or display settings. | External |
more | Display one page at a time. | External |
move | Move one or more files from one directory to another directory. | Internal |
msav | Early Microsoft Virus scanner. | External |
msd | Diagnostics utility. | External |
msdex | Utility used to load and provide access to the CD-ROM. | External |
nbtstat | Displays protocol statistics and current TCP/IP connections using NBT | External |
net | Update, fix, or view the network or network settings | External |
netsh | Configure dynamic and static network information from MS-DOS. | External |
netstat | Display the TCP/IP network protocol statistics and information. | External |
nlsfunc | Load country specific information. | External |
nslookup | Look up an IP address of a domain or host on a network. | External |
path | View and modify the computers path location. | Internal |
pathping | View and locate locations of network latency. | External |
pause | Command used in batch files to stop the processing of a command. | Internal |
ping | Test / send information to another network computer or network device. | External |
popd | Changes to the directory or network path stored by the pushd command. | Internal |
power | Conserve power with computer portables. | External |
Prints data to a printer port. | External | |
prompt | View and change the MS-DOS prompt. | Internal |
pushd | Stores a directory or network path in memory so it can be returned to at any time. | Internal |
qbasic | Open the QBasic. | External |
rd | Removes an empty directory. | Internal |
ren | Renames a file or directory. | Internal |
rename | Renames a file or directory. | Internal |
rmdir | Removes an empty directory. | Internal |
route | View and configure windows network route tables. | External |
runas | Enables a user to run a program as a different user. | External |
scandisk | Run the scandisk utility. | External |
scanreg | Scan registry and recover registry from errors. | External |
set | Change one variable or string to another. | Internal |
setlocal | Enables local environments to be changed without affecting anything else. | Internal |
setver | Change MS-DOS version to trick older MS-DOS programs. | External |
share | Installs support for file sharing and locking capabilities. | External |
shift | Changes the position of replaceable parameters in a batch program. | Internal |
shutdown | Shutdown the computer from the MS-DOS prompt. | External |
smartdrv | Create a disk cache in conventional memory or extended memory. | External |
sort | Sorts the input and displays the output to the screen. | External |
start | Start a separate window in Windows from the MS-DOS prompt. | Internal |
subst | Substitute a folder on your computer for another drive letter. | External |
switches | Remove add functions from MS-DOS. | Internal |
sys | Transfer system files to disk drive. | External |
telnet | Telnet to another computer / device from the prompt. | External |
time | View or modify the system time. | Internal |
title | Change the title of their MS-DOS window. | Internal |
tracert | Visually view a network packets route across a network. | External |
tree | View a visual tree of the hard disk drive. | External |
type | Display the contents of a file. | Internal |
undelete | Undelete a file that has been deleted. | External |
unformat | Unformat a hard disk drive. | External |
unlock | Unlock a disk drive. | Internal |
ver | Display the version information. | Internal |
verify | Enables or disables the feature to determine if files have been written properly. | Internal |
vol | Displays the volume information about the designated drive. | Internal |
xcopy | Copy multiple files, directories, and/or drives from one location to another. | External |
Change your DOS/Command prompt
- If you're in Windows, go to the "DOS Prompt" or the "Command Prompt"
- Type
PROMPT
followed by the format characters for your new prompt (only a few format characters are listed below to keep the compatibility. to find out all the codes available to you in your operating system, type "PROMPT/?" without the quotes and press ENTER):
$d -- current date
$t -- current time
$g -- ">" character
$p -- current path/directory
for example:
PROMPT $t $p $g
- Press ENTER
To share this: BlinkBits | BlinkList | Blogmarks | Co.mments | Connotea | Del.icio.us | Digg | Facebook | FrankIt | Furl | Ma.gnolia | Newsvine | Reddit | Yahoo
Applicable Keywords : MS-DOS 3.x, Windows NT, Windows NT 3.x, Windows NT 4.x, Windows, Windows 3.x, Windows 95
Random Tip : Font embedding for web pages
Next Tip : Direct DOS print outs to network printers
You have searched for "change directory dos prompt." You might be interested in the following threads: |
![]() |
changing cmd prompt directory
![]() | ![]() | ![]() | ![]() |

Is there an easy way to change the command prompt to always go to a specific directory?
Mine goes to c:/documents and settings/neenie
But I want it to automatically go to about four subdirectories (subfolders...whatever) below 'neenie'.
As in c:/documents and settings/neenie/my documents/programming/language/c
Thanks!
+2 | ![]() ![]() ![]() |
Chdir (Cd)Displays the name of the current directory or changes the current folder. Used with only a drive letter (for example, chdir C:), chdir displays the names of the current drive and folder. Used without parameters, chdir displays the current drive and directory.
Syntax
chdir [[/d] [Drive:][Path] [..]] [[/d] [Drive:][Path] [..]]
cd [[/d] [Drive:][Path] [..]] [[/d] [Drive:][Path] [..]]
Parameters
/d
Changes the current drive or the current directory for a drive.
[drive:][Path]
Specifies the drive (that is, if it is different from the current drive) and directory to which you want to change.
[..]
Specifies that you want to change to the parent folder.
/?
Displays help at the command prompt.
Remarks
Working with command extensions
With command extensions enabled (that is, the default), the current directory path matches the folder names exactly as they appear on your hard drive, using the same uppercase or lowercase folder-name format. For example, if the folder on your hard drive is called C:\Temp, CD C:\TEMP sets the current directory to C:\Temp to match the folder-name format of the folder on your hard drive.
To disable command extensions for a particular process, type:
cmd e:off
When you disable command extensions, chdir does not treat white spaces as delimiters. As a result, you can change to a subdirectory name that contains a white space without having to surround [Path] in quotation marks. For example, the following path changes to the \Start menu subdirectory:
cd \winnt\profiles\username\programs\start menu
For more information about enabling and disabling command extensions, see cmd in Related Topics.
Changing to the root directory
The root directory is the top of the directory hierarchy for a drive. To return to the root directory, type:
cd\
Changing the default directory on one drive from another drive
To change the default directory on a drive different from the one you are on, type one of the following:
chdir [Drive:\[directory]]
cd [Drive:\[directory]]
To verify the change to the directory, type one of the following:
chdir [Drive:]
cd [Drive:]
The chdir command, with different parameters, is available from the Recovery Console.
Examples
When you use it with a drive name, chdir displays the current directory for that drive. For example, if you type cd c: at the C:\Temp directory prompt, the following appears:
C:\Temp
To change your current directory to a directory named Reports, type one of the following commands:
chdir \reports
cd \reports
To change your current directory to a subdirectory \Specials\Sponsors, type:
cd \specials\sponsors
Or, if your current directory is \Specials, type the following command to change to the \Specials\Sponsors subdirectory:
cd sponsors
To change from a subdirectory to its parent directory, type:
cd ..
To display the name of the current directory, you can use chdir or cd without a parameter. For example, if your current directory is \Public\Jones on drive B, typing chdir the following appears:
B:\Public\Jones
If you are working on drive D and you want to copy all files in the \Public\Jones and \Public\Lewis directories on drive C to the root directory on drive D, type:
chdir c:\public\jones
copy c:*.* d:\
chdir c:\public\lewis
copy c:*.* d:\
If you want to copy all files in the \Public\Jones and \Public\Lewis directories to your current location on drive D, type:
chdir c:\public\jones
copy c:*.* d:
chdir c:\public\lewis
copy c:*.* d:
i_XpUser
+1 | ![]() ![]() ![]() |
Thanks, but I know how to switch from one directory to another from cmd.
My question was/is how can I change the command prompt to AUTOMATICALLY go to a specific directory?
Meaning, I want to have a cmd shortcut that will AUTOMATICALLY go a directory that I use all of the time. I already KNOW how to navigate from one directory to another from the prompt,...I want to set my command prompt to automatically go to a specific directory.
Specifically, instead of my command prompt automatically going to c:/doucuments and settings/neenie , I want it to AUTOMATICALLY go to c:/documents and settings/neenie/blah/blah blah/more blah/ blah blah blah
I can't think of any other way to make this more clear. But thanks anyway.
-1 | ![]() ![]() ![]() |
Good response from XpUser... a little bit acid from meanie!
Once I thought I was wrong, now I'm not so sure!
+2 | ![]() ![]() ![]() |
I have same question: Everytime I open my CMD, It opens into my H:\> dir, instead of C:\>. This happens to all login users to network, running Windows xp and login into AD/wind 2003, running Kix a login script from sysvol.
Is anyone knows what it caused for command to open into Home directory? and How I can change so it shouhd open into either current user profile or local C: drive ?
+1 | ![]() ![]() ![]() |
aamar butt you should repost your question as a fresh post. It is unlikely that anyone will find it tacked onto the end of someone elses.
Once I thought I was wrong, now I'm not so sure!
+4 | ![]() ![]() ![]() |
Hey there
I stumbled upon the same task today and found your post. I was lucky to find the solution to this.
Please visit http://windowsxp.mvps.org/autoruncmd.htm
or follow these steps
(1) At command prompt, type regedit.exe
(2) Navigate to "HKEY_CURRENT_USER\Software\Microsoft\Command Processor
(3) In the right hand panel, modify Autorun. If there is no Autorun present, Click Edit-> New->String Value
(4) Call it Autorun and type "cd\" if you want to set it to C: (provided Windows in installed on C drive). Say to want it to be C:\Abhi, type cd\Abhi.
I hope I am making this clear enough. I have tried it; and it works.
Sincerely
Abhijit
-2 | ![]() ![]() ![]() |
Thanks for posting that! I also stumbled upon this website and that was VERY helpful information!!
Thanks!
-Brittny
Check out:
http://ipods.freepay.com/?r=10871112 and get a free iPod!!
![]() |
![]() | task manager![]() |

Post Locked
Google Ads
Results for: change directory dos prompt
- Summary: How can I change the dos prompt from C:\Documents and Settings\My Name to just plain C:\? Why does it do this? I am trying to learn PERL and I would like my directories to be more streamlined. Any hel...
cmd change directory
- Summary: If you're literally doing a "cd to D:\" then that's your problem. CD is Change Directory - it doesn't do a change of drive - to do that, like in DOS in days of yore, you must change to the D: drive b...
How..change directories at command
- Summary: Hi, When i open the command prompt it opens to the c: drive. I can easily move within the c: directory but i cannot change directories. I want to work in my D: directory. cd d:\ does not work. chdir d...
No comments:
Post a Comment