BASH: Getting titlebar and prompt to 'sync up'

This is an instance of "if it's not one thing, it's another."

I recently fell victim to my own stupidity in trashing, by accident, my long-running and very highly-customized .bash_profile and .bashrc files for Cygwin & Cygwin/X. I had backups from a previous "go" with this, and decided to use them again as a starting point. Now I'm attempting to restore the prompt and titlebar customization that I had working in my more-recent set of config files.

Just as an FYI and to make sure we're all on the same page here: I use rxvt for Cygwin; for a long while, my preference has been to display the basename of the current working directory in the titlebar, and the full path in the prompt, "where there's more space to waste." Up to this moment, I've been able to set the titlebar to dynamically change on every cd command, but the prompt still shows whatever path the session began with, such as the home folder or the directory pointed to by a "Bash Here" contextual menu command or, otherwise, one custom batch script I retained from the config-trashing debacle.

The code in my .bash_profile looks like this:

case "$TERM" in
xterm*|rxvt*|rxvt-unicode*)
	export PS1="\e]2;\W - Cygwin\a\n${PWD}\n$TERM-cygwin>> "
        ;;
*)
       PROMPT_COMMAND='echo -e "\033]0;$TERM: ${PWD}\007"'
        ;;
esac

where everything (on the EXPORT line) before the \a sets the titlebar as I want it. However the same line's ${PWD}, for reasons I'm sure I know but have (for the time being at least) forgotten, isn't getting updated on execution of a cd command. I also am quite aware that all of this should be in discrete lines, for instance a PROMPT_COMMAND and a TITLEBAR variable in a function, rather than part of an export PS1="". However, trying the same syntax in the former has only resulted in a hanging cursor and no prompt whatsoever on starting a session.

And I'd like to have them 'sync-up.' I know it's possible because I had it working before the 'accident.'

Hope someone can help.

BZT

---------- Post updated at 20:02 ---------- Previous update was at 19:20 ----------

I saw, just now, where I was going wrong.
The EXPORT line (okay as it was) was off by one detail. The way to get the prompt to update 'on-the-fly' was not to use $PWD or any variation of it, but rather to use the character sequence \W. I typed that into my .bash_profile, source'd it from an open rxvt session and got the 'right look.' To make absolutely sure, I cd'd to another folder and watched both prompt and titlebar change.

It's usually the simple stuff, innit?

BZT