-2

Does anyone know, if it's possible to change the name of an other Program in the Taskmanager using C#? If yes how, cause I'm currently making a program, which searches Edge.exe and then i want it to change the name to Internet.exe

Clemens
  • 123,504
  • 12
  • 155
  • 268
Makusium
  • 201
  • 1
  • 2
  • 15

3 Answers3

3

So you want to

change the name of an other Program

but your query is impresise because there is a difference between the process name and the application name. The first is taken from the executables version-info resource, and can in C# be accessed by Process.ProcessName which is a read-only property so you can't set it.

You can't set it using any other method either for obvious reasons. Only malware would want to disguise in such a way.


You can however change the application name instead of the process name because it is linked to the title of the processes main window.

e.g. to change it you could use

[DllImport("user32.dll")]
private static extern bool SetWindowText(IntPtr hWnd, string text);

private void ChangeEdgeToInternet()
{
    foreach(Process process in Process.GetProcessesByName("Edge"))
    {
        SetWindowText(process.MainWindowHandle, "Internet");
    }
}
Thomas Flinkow
  • 4,845
  • 5
  • 29
  • 65
1

You can't do it without doing some undocumented memory access. In the end the information shown by the TaskManager in the Name column is taken from GetModuleBaseName() API. Clearly there is no SetModuleBaseName() API. There is another similar API: GetProcessImageFileName (), still no set.

xanatos
  • 109,618
  • 12
  • 197
  • 280
-3

You can rename the executable file of the program. Hopefully this will help.

System.IO.File.Move(directoryPath+"\\Edge.exe", directoryPath+"Internet.exe");
Munim Munna
  • 17,178
  • 6
  • 29
  • 58
GPU..
  • 175
  • 12