Why does running “main” in PowerShell open my mouse properties

Question:

I was setting up a programming environment and I went to run my Main.exe and due to lack of sleep I left out the .exe. To my surprise the mouse properties dialog opened up. I knew my hello world app wasn’t magically opening up mouse properties so I ran a quick Get-Command Main and it spat out C:\Windows\system32\main.cpl. So I guess the real question here is why does C:\Windows\system32\main.cpl open up my mouse properties?

Answer:

The .cpl extension is for control panel items, and the default “open with” is the control.exe executable. So when you enter main into your terminal, it is opening main.cpl with the control.exe executable, which is opens the mouse portion of the control panel. I have no idea why they chose to use main.cpl for the mouse properties, but here is a list of various other .cpl‘s to use with control.exe: https://support.microsoft.com/en-ie/help/149648/description-of-control-panel–cpl-files, also check out: https://www.lifewire.com/command-line-commands-for-control-panel-applets-2626060

I have actually used the mmsys.cpl to automate switching of sound devices.

Source:

Why does running “main” in PowerShell open my mouse properties by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply