12

I noticed when I press Ctrl+Alt+Del and click Task Manager, Windows calls taskmgr.exe /3 as the command. Several websites claim the Task Manager has no command line arguments.

Task Manager Processes in the Process Explorer

Why does Windows attach this argument?

  • Moreover, there's another, lesser weighting LaunchTM.exe in %windir%\System32 which makes it even more confusing as I could not figure out, basing on my google search as well, its purpose of existance and what it is good for in general. – user373230 Sep 30 '16 at 19:00
  • @Chinggis6 There is no LaunchTM.exe in Windows 7, you are on Windows 8 I think. Why not creating a new question regarding this here on superuser? ;) – modiX Oct 3 '16 at 17:25
13

Analysis

Apparently it's not a documented behavior. I did some tests, and noted my findings:

  • Right-click the taskbar, and click Start Task Manager.

    "C:\Windows\system32\taskmgr.exe" /4
    
  • Press Ctrl+Shift+Esc.

    taskmgr.exe /2
    
  • Press Ctrl+Alt+Del, and click Start Task Manager.

    taskmgr.exe /3
    
  • Start a non-elevated Task Manager, and click the Show processes from all users button.

    "C:\Windows\system32\taskmgr.exe" /1
    
  • Type or paste taskmgr.exe in the Start menu search bar, and press Enter; press Win+R, type or paste taskmgr.exe in the textbox, and press Enter; navigate to the System32 folder and double-click the taskmgr.exe executable; start the System Configuration utility (msconfig.exe), click the Tools tab, select the Task Manager item from the list, and click Launch.

    "C:\Windows\system32\taskmgr.exe"
    
  • Open a command prompt, type or paste taskmgr.exe, and press Enter.

    taskmgr.exe
    

Remarks

  • Things worked in a similar way during the development phase of Windows 8, up until the Release Preview. Windows Vista and earlier operating systems are unaffected.

  • The executable imports a couple of API functions (namely GetCommandLineW and CommandLineToArgvW) which are used to retrieve and parse command line arguments.

  • Manually starting the program using any of the arguments above doesn't seem to have any noticeable effect.

If I had to make an educated guess, I'd say that the numeric parameter was meant to be an internal startup indicator, possibly used for debugging purposes and then left behind.

  • 5
    "taskmgr /7 /startup" => start with Startup tab in front! (Windows 8.1) -- but neither "taskmgr /startup /7" nor "taskmgr /startup" does that! (Extra credit: Please explain the command line parsing algorithm of taskmgr.exe given this evidence...) – davidbak Jul 7 '15 at 17:18
  • 1
    @davidbak taskmgr /anything /startup works, so /startup as the second argument. – Michel de Ruiter Nov 14 '17 at 7:59
  • @MicheldeRuiter - Yes. Would it have killed them to allow arguments in any order? Caused extra work in QA? Delayed the ship date? HUH???? – davidbak Nov 14 '17 at 18:06
2

A few notes:

Just because a command is sent, does not mean that a program accepts those arguments, or any.

For example:

I called taskmanager with my own odd command and the behavoir did not change:

enter image description here

From a basic programming stand point, any application is going to have a main method of some sort where arguments can be passed in. For example a basic Windows Form C# application looks something like:

private void Form1_Load(object sender, EventArgs e)
        {

        }

If I pass some funny arguments in, nothing happens with the application, but Process Explorer will catch and display them.

enter image description here

If I explicitly decide to handle them however, you will get interaction from the command.

enter image description here

And all I had to do was change the entry point of the form slightly:

private void Form1_Load(object sender, EventArgs e)
        {
            string arguments = Environment.GetCommandLineArgs()[1];

            this.Text = arguments;
        }

Now, back to your question on why it is there:

If you access taskmgr.exe from the ctrl + alt + del method, you do indeed see the command argument "/3". Also if you use ctrl + shift + esc it passes /2 and if you right click the taskbar and click "Start Task Manager" the switch shown is /4.

All of this leads me to assume maybe there is something that Windows needs to know, or perhaps was nearly implemented for the Taskmanager that we don't know about. For example, security in Windows might want to know if ctrl + alt + del was used to call taskmgr.exe and not a script or user. Again, pure speculation but threads like this make me think it might have been at least a thought.


For the infamous tl;dr

To know why Windows passes these commands we likely need either a member of Microsoft's development team, or the source code. There might not be a better answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.