I want to change the title of the PowerShell window to the command line of the currently executing process inside it, just like CMD.EXE does.
Can I do this in PowerShell?
Is there some function like prompt
which is called when I execute a command in PowerSHell?
Do you want it for a small select number of executables? Or all exes?
One hack for a select number of executables would to do
Then just run cd c: cmd /c dir /s
And see the title change
And for all the commands
And then try ping 127.0.0.1
Its hacky, YMMV
This is definitely possible, though you do have to code for it yourself. This TechNet article describes how to change the Title line of the executing window.
http://technet.microsoft.com/en-us/library/ee156814.aspx
Yes there is, this is my function for prompt, it put the last part of the actual path in the prompt. Also set the window title and when you runit as admin change the background and add a Admin: in the title.
Put that in your profile, remember that any profile is accesible directly with the profile variable: $profile.CurrentUserCurrentHost, $profile.CurrentuserAllhost ....etc.