In Windows Vista, is there a way to remove the word 'Administrator:' from the title of a command prompt window?
The 'title' command just updates the part after 'Administrator:', so that will not do.
In Windows Vista, is there a way to remove the word 'Administrator:' from the title of a command prompt window?
The 'title' command just updates the part after 'Administrator:', so that will not do.
There are another two possibilities here:
You’ll need to modify the MUI data file for cmd.exe. This file is called cmd.exe.mui, and is located in C:\Windows\System32\en-US on a standard 32-bit, United States installation. For other languages, the en-US will be different, and for 64-bit installations, you’ll need to modify both the version in System32 and in SysWOW64.
First off, take ownership of cmd.exe.mui. Right-click on the file, click Advanced on the security tab. On the Owner tab, click Edit, and select the Administrators account.
Now, give access to modify the file. Go back into the properties for the file, click Edit on the Security tab, click Add, and enter Administrators, then make sure they have the Full Control option set to Allow.
Using a hex editor, resource editor, or other editor of your choice, modify the string in the file from “Administrator: %0” to “ %0” (That’s two spaces before the %0, don’t forget the null character at the end).
Save the file
Run mcbuilder.exe (this could take some time to run)
Reboot the computer.
(from this thread - note, you can use a space, but it has to be something.)
While it has been proven not to solve the problem in this bug, not everyone knows you can use the title command and set the title to whatever you want it to be.
Run the command prompt as a standard user (ie be logged in as a standard user).
If needed, you can always use runas to run commands as any other user including whatever adminstrative users you have.
I just created a simple PowerShell script that rely on a .NET class compiled at runtime to automate the steps explained in @crb answer.
This solution works for English and Spanish versions of the cmd.exe.mui
file, and I made it easy to add support for more languages just by adding new entries to the dict
object.
Enjoy!.
$source = @'
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
imports System.Diagnostics
Imports System.IO
imports System.Linq
Imports System.Text
Public NotInheritable Class MainClass
Public Shared Sub Main()
Dim dict As New Dictionary(Of String(), String) From {
{{Environment.ExpandEnvironmentVariables("%SystemRoot%\System32\en-US\cmd.exe.mui"),
Environment.ExpandEnvironmentVariables("%SystemRoot%\SysWOW64\en-US\cmd.exe.mui")},
"Administrator: "},
{{Environment.ExpandEnvironmentVariables("%SystemRoot%\System32\es-ES\cmd.exe.mui"),
Environment.ExpandEnvironmentVariables("%SystemRoot%\SysWOW64\es-ES\cmd.exe.mui")},
"Administrador: "}
}
For Each key As String() In dict.Keys
For Each filepath As String In key
If File.Exists(filepath) Then
Console.WriteLine(String.Format("Searching for string: '{0}' in file: '{1}'", dict(key), filepath))
ReplaceBytes(filepath, Encoding.GetEncoding("UTF-16").GetBytes(dict(key)), {&H81, &H0})
End If
Next filepath
Next key
End Sub
Private Shared Sub ReplaceBytes(filepath As String, find As Byte(), replace As Byte())
Dim buffer As Byte() = File.ReadAllBytes(filepath)
Dim index As Integer = FindByteSequence(buffer, find, 0).DefaultIfEmpty(-1).SingleOrDefault()
If (index <> -1) Then
If Not File.Exists(String.Format("{0}.bak", filepath)) Then
Console.WriteLine(String.Format("Creating backup file: '{0}.bak'", filepath))
File.Copy(filepath, String.Format("{0}.bak", filepath), overwrite:=False)
End If
buffer = buffer.Take(index).Concat(replace).Concat(buffer.Skip(index + find.Length)).ToArray()
Console.WriteLine(String.Format("Rebuilding file: '{0}'", filepath))
Using fs As New FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.None)
fs.Write(buffer, 0, buffer.Length)
End Using
Else
Console.WriteLine(String.Format("String not found in file: '{0}'", filepath))
End If
End Sub
' Original author: https://stackoverflow.com/a/332667/1248295
Private Shared Function FindByteSequence(buffer As Byte(), pattern As Byte(), startIndex As Integer) As ReadOnlyCollection(Of Integer)
Dim positions As New List(Of Integer)
Dim i As Integer = Array.IndexOf(buffer, pattern(0), startIndex)
Do While (i >= 0) AndAlso (i <= (buffer.Length - pattern.Length))
Dim segment(pattern.Length - 1) As Byte
System.Buffer.BlockCopy(buffer, i, segment, 0, pattern.Length)
If segment.SequenceEqual(pattern) Then
positions.Add(i)
End If
i = Array.IndexOf(buffer, pattern(0), i + 1)
Loop
Return positions.AsReadOnly()
End Function
End Class
'@
$vbType = Add-Type -TypeDefinition $source `
-CodeDomProvider (New-Object Microsoft.VisualBasic.VBCodeProvider) `
-PassThru `
-ReferencedAssemblies "Microsoft.VisualBasic.dll", `
"System.dll" `
| where { $_.IsPublic }
[MainClass]::Main()
$Console = [System.Console]
$Console::WriteLine("All done. Press any key to exit...")
$Console::ReadKey($true)
Exit(0)
Notes:
Tested on Windows 10.0.18363.959 with PowerShell 5.1.18362.752
In @crb answer it says in a 64-Bit O.S the user needs to modify also the cmd.exe.mui
file in SysWOW64 dir, however I have a 64-bit Windows 10 and that file does not exist inside SysWOW64 dir, anyways I added that path to the code in case of.
I didn't add any instruction to run mcbuilder.exe
since I found it is not really necessary ...at least for me, the change is applied directly when opening a new instance of the CMD.
I stopped using the standard cmd.exe shell, and am now using Console2 which does not have this 'administrator' problem.
Why do you want to remove it? It's there to signify that you're running an elevated command prompt as opposed to a regular command prompt.
If you've disabled the UAC then you might see this on all your command prompts as you're basically always running in elevated mode
I haven't tried this, but what about creating an Administrator account called "a", and then changing your CMD shortcut to be a "runas," calling CMD with "a" as the user.
That will shorten up the name so you can fit the real title nicely in the taskbar (which you indicated was your goal for doing this).