cmd.exe title bar and prompt

G

Guest

Hi,

1. Is there a way I can get cmd.exe to put the current path into the window
title bar.

2. Is there a way to not have the current path in the prompt.
 
G

Guest

Ken Blake said:
Not that I know of.




Issue the command

prompt $g


--
Ken Blake - Microsoft MVP Windows: Shell/User
Please reply to the newsgroup


Thanks Ken - I'll paste that into my brain.

pity about Q1 tho', I often have several cmd.exe's stacked up and there's no
way to tell one from t'other in the task bar, maybe there is in CoolSwitch,
on another computer at the moment - CoolSwitch is disabled.

Rgds PhilD
 
D

David Candy

If you set shortcuts to each folder the window will take the name of the shortcut.
 
W

Wesley Vogel

You can set the title differently for every command prompt that you have
open.

Type:

title /?

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
G

Guest

Thanks for your suggestion david, but I have lots of directories that are
many layers deep. Being ex miltary makes me think in hierarchies. I'd I'd
have to agonise over where to put the shortcuts

Cheers PhilD
 
G

Guest

Wes

title "Documents and Settings" - worked a treat, but title /? told me that
the title command only accepted a string constant as an arguments

But cut and paste of the path from the prompt into the title command prior
to applying Ken's Prompt $g to get expunge the path from the prompt the
trick.

I'll try to find a way to automate it - if I find a way that utilises non MS
software is it appropriate to post findings in this forum.

As an aside - I know what ObjectId's are and I know how to manipulate them
with fsutil - but what purpose do they serve, I think I might have a use for
them, but I want to turn them on and have Winda's create them when files and
folders are created. Only reference to their use I can find is file
replication services (FRS) which I understand is a server application, not
something one runs on an XP workstation, I do not want to upgrade my XP to NT
Server thanks

Finally what's a - "MS-MVP Windows Shell/User", that all you guys seem to
be. Surely you can't all be microsoft millionare vice presidents, or perhaps
you can.

Cheers
 
P

Phil Robyn

Philip said:
Hi,

1. Is there a way I can get cmd.exe to put the current path into the window
title bar.

Yes, you can make a batch file called, say, 'mycd.cmd' and use it
religiously every time you issue a change-directory command.

@echo off
cd %*
title %cd%
2. Is there a way to not have the current path in the prompt.

prompt /?
 
T

Tim Slattery

Philip said:
Finally what's a - "MS-MVP Windows Shell/User", that all you guys seem to
be. Surely you can't all be microsoft millionare vice presidents, or perhaps
you can.

The MVP program is explained here:
 
K

Ken Blake, MVP

Wesley said:
You can set the title differently for every command prompt that you
have open.

Type:

title /?


Thanks very much, Wes. I never knew about that one.
 
K

Ken Blake, MVP

Philip said:
Finally what's a - "MS-MVP Windows Shell/User", that all you guys
seem to be. Surely you can't all be microsoft millionare vice
presidents, or perhaps you can.


Would that we were!

No, the MVP title is strictly an honorary one. We are not Microsoft
employees, but just volunteers who have been given this honorary title for
consistently supplying accurate information in places like this newsgroup.
See
 
W

Wesley Vogel

Philip,

#$%#$%#$%!!!!!!!!!! Son of a gun, it's been a fun morning. ;-)

IE crashed at MSDN. My machine crashed while messing with this. Too much
monkey business.

[[Whenever you subsequently use the CD command to change directories, the
current directory will be displayed in the title bar of the command
prompt. ]]
How to Change the Title Bar Caption of the Command Prompt
http://support.microsoft.com/default.aspx?scid=kb;en-us;98578

I had to mess with it for a while, but it does work in XP.

First, do not name it title.cmd. I changed it to bar.cmd.
Second, place somename.cmd in C:\WINDOWS, not C:\

Otherwise it works fine and looks just like what you want.

I missed your first original question...

Right click the Desktop | New | Shortcut |
Paste this in the location box:

%SystemRoot%\system32\cmd.exe

Click Next | Click Finish |

Right click the new cmd.exe shortcut | Properties |
In the Start in box replace %windir% with C:\ |
Click Apply | Click OK

Any proper path will work in the Start in box.

You can also change the Start in for the cmd shortcut located under
Accessories on the Start Menu.
--------------

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>
----

Then use the new shortcut instead of Start | Run | cmd

You can change to the Canadian prompt if you want:

prompt eh?

Just a joke, but it works. :-D

As for the title command, string specifies the title for the command prompt
window. The only characters that will not work are < > | The comma and
semi colon will work as long as they are not the first characters.

I am hitting the Save button a lot now. :)

Title command help...
Start | Run | Paste: hh ntcmds.chm::/title.htm | Click OK

No, I am just a billionaire with a lot of time on my hands.

Tim Slattery and Ken Blake have posted links to the MVP site.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
W

Wesley Vogel

Hi Ken,

I stumble across a gem now and again. ;-) I just happened to be messing
around with title a couple of days ago so CRS hadn't set in and I remembered
it.

Another tip, if you change the icon on your cmd shortcut, that icon will be
displayed in the Title bar instead of the default icon. I discovered that
one by accident, like all the good ones.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
G

Guest

Done I also changed relevant registry entries to change prompt and title,
when I invoke cmd

I dont have a trouble with typing pd innstead of cd, but getting away from
typing .. is a bit hard

I'm happy to close this matter of with a big tick, unless anyone has
solution for ..

Thanks all PhilD
 
P

Phil Robyn

Philip said:
Done I also changed relevant registry entries to change prompt and title,
when I invoke cmd

I dont have a trouble with typing pd innstead of cd, but getting away from
typing .. is a bit hard

I'm happy to close this matter of with a big tick, unless anyone has
solution for ..

Thanks all PhilD

Glad it worked for you. But besides 'cd' there are also 'pushd' and
'popd' change-directory commands. In order to accommodate all these
different ways of changing directory and having the name of the current
directory appear in the title bar of the CMD prompt window, maybe we
should modify our original suggestion a bit. Let's say you want to use
the following syntax:

pd \some\directory

pd push \some\directory

pd pop

So pd.cmd would have to look like this:

==========begin file C:\CMD\TEST\pd.cmd ==========
001. @echo off
002. ::
003. :: display the current directory in the title bar of the
004. :: CMD console window
005. ::
006. if "%~1" equ "" goto :done
007. if /i "%~1" equ "push" (
008. call :push %*
009. goto :done
010. )
011. if /i "%~1" equ "pop" (
012. popd
013. goto :done
014. )
015. cd %1
016. :done
017. title %cd%
018. goto :EOF
019. :push
020. shift
021. pushd %1
022. goto :EOF
==========end file C:\CMD\TEST\pd.cmd ==========
 
D

David Candy

doskey cd=cd %*$ttitle %cd%

Replaces XP's CD with your required CD. Type doskey /? for help.
 
P

Phil Robyn

Philip said:
Done I also changed relevant registry entries to change prompt and title,
when I invoke cmd

I dont have a trouble with typing pd innstead of cd, but getting away from
typing .. is a bit hard

I'm happy to close this matter of with a big tick, unless anyone has
solution for ..

Thanks all PhilD

Glad it worked for you. But besides 'cd' there are also 'pushd' and
'popd' change-directory commands. In order to accommodate all these
different ways of changing directory and having the name of the current
directory appear in the title bar of the CMD prompt window, maybe we
should modify our original suggestion a bit. Let's say you want to use
the following syntax:

pd \some\directory

pd push \some\directory

pd pop

So pd.cmd would have to look like this:

==========begin file C:\CMD\TEST\pd.cmd ==========
001. @echo off
002. ::
003. :: display the current directory in the title bar of the
004. :: CMD console window
005. ::
006. if "%~1" equ "" goto :done
007. if /i "%~1" equ "push" (
008. call :push %*
009. goto :done
010. )
011. if /i "%~1" equ "pop" (
012. popd
013. goto :done
014. )
015. cd %1
016. :done
017. title %cd%
018. goto :EOF
019. :push
020. shift
021. pushd %1
022. goto :EOF
==========end file C:\CMD\TEST\pd.cmd ==========
 
P

Phil Robyn

David said:
doskey pushd=pushd $*$ttitle $*
doskey popd=popd$ttitle %cd%

Change the first one to '... title %cd%', not '... title $*'.
What if the content of '$*' is not a valid (sub)directory???
 
P

Phil Robyn

David said:
doskey pushd=pushd $*$ttitle $*
doskey popd=popd$ttitle %cd%

change the first one to '... title %cd%', not '... title $*'.
What if the value of '$*' is not a valid (sub)directory???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top