Update ConEmu tab with current path
PowerShell
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.