Closed chrisbenti closed 10 years ago
ConEmu sets a bunch of environment variables relating to it within its shells (since I assume that's what this is mostly for); on top of that, standard cmd-based prompts seem to have env:PROMPT defined, whereas powershell ones do not. Powershell shells within ConEmu do not have env:PROMPT set, same as a normal powershell prompt. I know that environment variables aren't necessarily that safe, but if you wanted to determine based on them (as the window title may be worse)...
You could filter as such:
function Vanilla-Window{
if($env:PROMPT -or $env:ConEmuANSI){
# Console
return $false
} else {
# Powershell
return $true
}
}
Which in my tests functions correctly in powershell shells within and without ConEmu, even if their names are blank (obviously).
See here