File tree Expand file tree Collapse file tree
src/Microsoft.PowerShell.ConsoleHost Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,13 +45,12 @@ class ConsoleHostRawUserInterface : System.Management.Automation.Host.PSHostRawU
4545 var principal = new WindowsPrincipal ( identity ) ;
4646 if ( principal . IsInRole ( WindowsBuiltInRole . Administrator ) )
4747 {
48- // check using Regex if the window already has Administrator: prefix
49- // (i.e. from the parent console process)
50- string template = ConsoleHostRawUserInterfaceStrings . WindowTitleTemplate ;
51- string windowTitle = WindowTitle ;
52- if ( ! windowTitle . AsSpan ( ) . StartsWith ( template . AsSpan ( 0 , template . IndexOf ( '{' ) ) ) )
48+ // Check if the window already has the "Administrator: " prefix (i.e. from the parent console process).
49+ ReadOnlySpan < char > prefix = ConsoleHostRawUserInterfaceStrings . WindowTitleElevatedPrefix ;
50+ ReadOnlySpan < char > windowTitle = WindowTitle ;
51+ if ( ! windowTitle . StartsWith ( prefix ) )
5352 {
54- WindowTitle = StringUtil . Format ( template , windowTitle ) ;
53+ WindowTitle = string . Concat ( prefix , windowTitle ) ;
5554 }
5655 }
5756 } ) ;
Original file line number Diff line number Diff line change 171171 <data name =" WindowTitleTooLongErrorTemplate" xml : space =" preserve" >
172172 <value >Window title cannot be longer than {0} characters.</value >
173173 </data >
174- <data name =" WindowTitleTemplate " xml : space =" preserve" >
175- <value >Administrator: {0} </value >
174+ <data name =" WindowTitleElevatedPrefix " xml : space =" preserve" >
175+ <value >Administrator: </value >
176176 </data >
177177</root >
You can’t perform that action at this time.
0 commit comments