PC Review


Reply
Thread Tools Rate Thread

command prompt title bar

 
 
DbDutch
Guest
Posts: n/a
 
      10th Aug 2005
Is it possible to change the title of the command prompt to reflect the
current directory?

I can use $P$G to get the current drive and directory, but that eats up
screen real estate. I have tried adding $_ which acts like and CrLf, but I
don't like it as much.

I realize this is petty, but just curious. I tried changing the properties
of the shortcut, but came up empty.

All thoughts, flames, and ideas gratefully accepted.



 
Reply With Quote
 
 
 
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      10th Aug 2005
Not in realtime no, you can of course set the title to the current
directory using -

title %CD%

.... but that's only going to set the title to the current-directory at
the time the command is executed, once you change directory the title
will continue to reflect the previous current-directory.

You might consider writing a simple script that wraps the CD command for
you -

[SD.CMD]
@echo off
cd %*
title %CD%
[/SD.CMD]

.... now, when changing directory, use the SD command instead of CD.
Ensure SD.CMD is placed somewhere within your system's path. You may
also want to consider using the PUSHD command within the script as
opposed to CD to extend its capabilities.

HTH

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l

DbDutch wrote:
> Is it possible to change the title of the command prompt to reflect
> the current directory?
>
> I can use $P$G to get the current drive and directory, but that eats
> up screen real estate. I have tried adding $_ which acts like and
> CrLf, but I don't like it as much.
>
> I realize this is petty, but just curious. I tried changing the
> properties of the shortcut, but came up empty.
>
> All thoughts, flames, and ideas gratefully accepted.



 
Reply With Quote
 
Ed Siff
Guest
Posts: n/a
 
      12th Aug 2005
Make a batch file named mcd.bat with these lines in it and make sure it is in
your path:

@echo off
cls
cd %1
for /f "Tokens=*" %%i in ('CD') do set CurDir=%%i
title %curdir%

Start a command window and type mcd. That should changet the title to the
current dir. When you want to change directories, use mcd instead of cd.

(info found at http://www.jsifaq.com/subj/tip4600/rh4603.htm)

Ed



In article <(E-Mail Removed)>, "DbDutch" <(E-Mail Removed)>
wrote:
>Is it possible to change the title of the command prompt to reflect the
>current directory?
>
>I can use $P$G to get the current drive and directory, but that eats up
>screen real estate. I have tried adding $_ which acts like and CrLf, but I
>don't like it as much.
>
>I realize this is petty, but just curious. I tried changing the properties
>of the shortcut, but came up empty.
>
>All thoughts, flames, and ideas gratefully accepted.
>
>
>

 
Reply With Quote
 
Larry__Weiss
Guest
Posts: n/a
 
      12th Aug 2005
Dean Wells [MVP] wrote:
> You might consider writing a simple script that wraps the CD command for you -
>
> [SD.CMD]
> @echo off
> cd %*
> title %CD%
> [/SD.CMD]
>
> ... now, when changing directory, use the SD command instead of CD.
> Ensure SD.CMD is placed somewhere within your system's path. You may
> also want to consider using the PUSHD command within the script as
> opposed to CD to extend its capabilities.
>


That's nice in that if you suspect that you or some other script or
program has used CD or CHDIR (or programmatic equivalent) to change
the current directory, you can just type
SD
with no arguments to ensure that the title is current.

prompt $N:^^

complements using the title bar for the current directory to remind you
where to look for it.

It is a shame that there is not something you could pass to the PROMPT
command to allow "realtime" setting of the title every time the prompt
string is refreshed.

- Larry
 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      15th Aug 2005
On Fri, 12 Aug 2005 15:49:27 -0500, Larry__Weiss <(E-Mail Removed)> wrote
in microsoft.public.win2000.cmdprompt.admin:

[snip]
>It is a shame that there is not something you could pass to the PROMPT
>command to allow "realtime" setting of the title every time the prompt
>string is refreshed.


That's why there are real command line interpreters. CMD.EXE is no more
useful for serious CLI work than WordPad is for serious word processing.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
Charles Dye
Guest
Posts: n/a
 
      15th Aug 2005
On Mon, 15 Aug 2005 01:08:10 GMT, Michael Bednarek
<ROT13-abfcnz-(E-Mail Removed)> wrote:

>On Fri, 12 Aug 2005 15:49:27 -0500, Larry__Weiss <(E-Mail Removed)> wrote
>in microsoft.public.win2000.cmdprompt.admin:
>
>[snip]
>>It is a shame that there is not something you could pass to the PROMPT
>>command to allow "realtime" setting of the title every time the prompt
>>string is refreshed.

>
>That's why there are real command line interpreters. CMD.EXE is no more
>useful for serious CLI work than WordPad is for serious word processing.


E.g. 4NT, which supports:

set titleprompt=$p$g

--
Charles Dye (E-Mail Removed)

 
Reply With Quote
 
=?iso-8859-1?q?J._Baumg=E4rtel?=
Guest
Posts: n/a
 
      18th Aug 2005
Larry__Weiss schrieb:


> It is a shame that there is not something you could pass to the PROMPT
> command to allow "realtime" setting of the title every time the prompt
> string is refreshed.
>
> - Larry


Hi Larry,
try the following:
1. Write the following line to e.g. %systemroot%\system32\doskey.mac:
cd=cd /d $*$Ttitle %cd%
2. Create a link to cmd.exe with the following commandline (one long
line):
%SystemRoot%\system32\cmd.exe /k doskey
/macrofile=%systemroot%\system32\doskey.mac&title %cd%
3. Open your shell via that link and you have what you want.

- there´s only one little problem: you shouldn´t use the syntax cd\
(without blank) anymore, because that isn´t recognized from doskey as
a macro.

-Jochen

 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      18th Aug 2005
Great suggestion!

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l

J. Baumgärtel wrote:
> Larry__Weiss schrieb:
>
>
>> It is a shame that there is not something you could pass to the
>> PROMPT command to allow "realtime" setting of the title every time
>> the prompt string is refreshed.
>>
>> - Larry

>
> Hi Larry,
> try the following:
> 1. Write the following line to e.g. %systemroot%\system32\doskey.mac:
> cd=cd /d $*$Ttitle %cd%
> 2. Create a link to cmd.exe with the following commandline (one long
> line):
> %SystemRoot%\system32\cmd.exe /k doskey
> /macrofile=%systemroot%\system32\doskey.mac&title %cd%
> 3. Open your shell via that link and you have what you want.
>
> - there´s only one little problem: you shouldn´t use the syntax cd\
> (without blank) anymore, because that isn´t recognized from doskey as
> a macro.
>
> -Jochen



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the title of the command prompt window ? flahmeshess Microsoft Windows 2000 4 1st Mar 2007 06:00 PM
NO COMMAND PROMPT OR RECOVERY CONSOLE PROMPT =?Utf-8?B?QV9EVUI=?= Windows XP Performance 1 6th Aug 2006 09:06 PM
Changing prompt from C:\documents and settings\ to C:\ within command prompt Nulligan@gmail.com Windows XP General 4 1st Aug 2006 08:10 PM
Change the "Click to Add Title/Subtitle" prompt on a Title Master =?Utf-8?B?SmVubmlmZXJMZWU=?= Microsoft Powerpoint 1 28th Jun 2005 06:48 PM
Permission Denied while running cscript command in command prompt Eric Microsoft Windows 2000 CMD Promt 0 3rd Oct 2003 08:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:59 PM.