How can we center text in PowerShell? WindowWidth doesn\'t exist apparently, so is there a way somehow to keep the text centered?
WindowWidth
We want this output :<
function Write-HostCenter { param($Message) Write-Host ("{0}{1}" -f (' ' * (([Math]::Max(0, $Host.UI.RawUI.BufferSize.Width / 2) - [Math]::Floor($Message.Length / 2)))), $Message) } Write-HostCenter '*' Write-HostCenter '***' Write-HostCenter '*****'