1.

Solve : Changing CMD.EXE prompt and current working directory permanently?

Answer»

Hello,

I was just wondering if anyone knew how to change the prompt and current working directory when running cmd in windows XP. My current working directory when I run the command prompt is

Windows version CRAP...

C:\Documents and Settings\jshowa>

I want my working directory to be just plain "C:\" and I want to display the date and time. I looked on this site and it said something about changing the prompt using "prompt $t $d$_$p$g" and to make the change permanent, to edit the autoexec.bat file. However when I add the "prompt $t $d$_$p$g" to the batch file, save it, then reload cmd.exe from run in Win XP it doesn't change anything. Can someone help me out?

Welcome to the CH forums.

The easiest way to achieve what you want is to set up a shortcut on your desktop to access the Command Prompt in XP.

The Target line in the shortcut (R.click the shortcut then L.click Properties>Shortcut Tab) should be edited to show:

C:\WINDOWS\SYSTEM32\CMD.EXE /T:1F /K PROMPT $T $D $P$G

and the Start In line in the shortcut should be edited to show just C:\

Upper case used for emphasis only... $_ appears to generate a Return so should not be used unless you specifically want a 2-line Command Prompt.

If you want to know what /T:1F and /K do enter cmd/? at the Command prompt.

I think you will want to SHORTEN your Command Prompt somewhat when you see what is displayed.

Good luck.

P.S. Autoexec.bat is not used with cmd.exe (I think)

The standard prompt shows the current logged directory (the directory you are in). if you want to see "C:\" at the prompt, why not just type

CD C:\

Quote from: contrex on June 28, 2007, 02:00:35 AM

The standard prompt shows the current logged directory (the directory you are in). if you want to see "C:\" at the prompt, why not just type

CD C:\


Or... just CD\ would do the same thing but then the OP would have to type his Prompt command each time or maybe set up a .bat file to create the required Prompt.. Creating the Shortcut to the Command Prompt as explained in my first response above does the lot with just ONE click and there are also other options available such as using a Window or Full Screen mode that the OP might get round to investigating..

Neither CD C:\ nor CD\ clears the version information which the Op describes as "Windows version crap", he'll have to type CLS as well!! The shortcut to Command Prompt will open either a clean Command Prompt Window or Full Screen as selected by the OP.

Problem solved. Thanks a lot.

I just used $_ to clean up the command prompt, but I can experiment a little more to figure out what I want.How will you know what directory you are in? Are you never, ever, going to be in another directory?

I tried prompt $_ and got just a blinking cursor and a two line gap between commands.

A nightmare!



I just used $_ to feed the information that I had to a new line. I didn't want the information all on one line so I had to move it down. I added $P$G to the end of the "target" for the shortcut to put my current working directory as C:\> which is the current path.

I'm pretty sure you know all of this, but here's where I have it now

Target: C:\WINDOWS\system32\cmd.exe /K PROMPT Welcome Jacob Howarth!$_$V$_$T $D$_$_$P$G

Start in: C:\

This under the shortcut tab that Dusty mentioned above.

However, I have another problem, I was wondering if I could get it to not print the same prompt EVERYTIME I enter a command. For example my current cmd.exe window shows this

Welcome Jacob Howath!
Microsoft Windows XP Version [5.1.2600]
19:24:00.46 Tue 07/03/2007

C:\

However, whenever I type a command "cd" or something it prints the same information after each command is entered. I only want it to display at start up. Does anyone have any guidance? I would gladly appreciate it.If you just want a neat opening message, you might be better off leaving the prompt alone and making the shortcut target something like this

C:\WINDOWS\system32\cmd.exe /K echo Welcome Jacob Howath! & ver & echo %time% %date%

Unfortunately I cannot get %date% to show the 3 letter day of the WEEK ("Wed"), I think this depends on your locale, in my locale, English (United Kingdom) I just get dd/mm/yyyy eg 04/07/2007 but I believe in the English (US) locale you would get "Wed 07/04/2007"

Thanks for the advice. It works perfectly.


Discussion

No Comment Found