0

I'm using PowerShell as my shell with iTerm2 on macOS.

I know it's possible on bash and zsh but running the recommended solution doesn't work in powershell, because the ANSI escape doesn't work:

PS ~> echo -ne "\033]1;Title\007"
-ne
\033]1;Title\007
PS ~>

It should be possible to shell out to i.e. zsh from powershell to use these ANSI escapes, but I'd like a PowerShell-native solution.

Carl Walsh
  • 393
  • 3
  • 16

1 Answers1

1

PowerShell special characters for \033 ESC is "`e", and for \007 BEL is "`a". Using these values:

PS ~>"`e]1;Title`a"

to change your tab title to "Title". (echo is redundant to output values.)

You can instead change the iTerm window title with 2 instead of 1: "`e]2;WindowTitle`a". There are several more iTerm2 escape codes you can use.

Carl Walsh
  • 393
  • 3
  • 16