On ConEmu I'm opening a powershell console. I'd like the title of the tab to reflect the current folder I'm in. However, by default, the title is "Windows Powershell."

I specified the tab title in my task to be "C:\Code" and it updates, but that is hard coded.

Is there a way to open a powershell console, and as I navigate have it show me the current directory in the tab title?

1 Answer 1



Change prompt function in your powershell profile.

Open your profile in the editor, Notepad for example

new-item -itemtype file -path $profile
notepad $profile

Add following function to change (rename actually) ConEmu tab each time prompt appears

function prompt
  & "$env:ConEmuBaseDir\ConEmuC.exe" "/GUIMACRO", 'Rename(0,@"'$(Get-Location)'")' > $null
  return "PS " + $(Get-Location) + ">"

or use following code to change console title, but not tab

function prompt
  & "$env:ConEmuBaseDir\ConEmuC.exe" "/GUIMACRO", 'Rename(1,@"'$(Get-Location)'")' > $null
  return "PS " + $(Get-Location) + ">"

May be need to change this code, if you need to use PowerShell outside of ConEmu.

cmd (let it be in one answer)

If you are using cmd.exe, you may update ConEmu tab with cmd's current directory using prompt and ANSI. Just run your cmd as following:

cmd /k prompt $p$e]9;3;"$p"$e\$g & title cmd

To be able to process ANSI you need to enable Inject ConEmuHk and ANSI X3.64 options in the ConEmu's Features settings page (they are enabled by default). RightClick on the ConEmu's window title or press WinAltP to open Settings dialog.

Note, & title cmd in the example is not required, just for prettify window caption.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.