Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Command line to "Close Control Panel Applet"?

08 Apr 2015   #1

Win7 64-bit
Command line to "Close Control Panel Applet"?


I would like to know if there is a way to "close" an open Control Panel Applet via a command line reference?I know a couple ways to open the window -

"c:\windows\system32\mmsys.cpl" OR command mmsys.cpl

but I would like to also close it via command line. Any suggestions?

My System SpecsSystem Spec
08 Apr 2015   #2

Windows 10 Pro X64

Enter taskkill /? from a Elevated Command prompt. That is one way.
My System SpecsSystem Spec
08 Apr 2015   #3

Win7 64-bit

I tried that to no avail, but maybe my syntax is bad --

control taskkill /F /IM mmsys.cpl
My System SpecsSystem Spec

08 Apr 2015   #4

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan

Quote   Quote: Originally Posted by Ztruker View Post
Enter taskkill /? from a Elevated Command prompt. That is one way.
That is one way.
taskkill /im rundll32.exe
But it's not so safe if there happens to be other Rundll32 processes running.

A safer method would be to use a bit of VBScript.

Set objShell = CreateObject("WScript.Shell")
> "%TEMP%\tmp_%~n0.vbs" (
	echo Set objShell = CreateObject^("WScript.Shell"^)
	echo objShell.AppActivate^("Sound"^)
	echo objShell.SendKeys^("%%{F4}"^)
WScript "%TEMP%\tmp_%~n0.vbs"
del "%TEMP%\tmp_%~n0.vbs"

REM Same as the above but on one line:
(echo Set objShell = CreateObject^("WScript.Shell"^)&echo objShell.AppActivate^("Sound"^)&echo objShell.SendKeys^("%%{F4}"^))>"%TEMP%\tmp_%~n0.vbs"&&(WScript "%TEMP%\tmp_%~n0.vbs"&del "%TEMP%\tmp_%~n0.vbs")
Command Line command
(echo Set objShell = CreateObject^("WScript.Shell"^)&echo objShell.AppActivate^("Sound"^)&echo objShell.SendKeys^("%{F4}"^))>"%TEMP%\tmp_CloseSound.vbs"&&(WScript "%TEMP%\tmp_CloseSound.vbs"&timeout 1 >NUL&del "%TEMP%\tmp_CloseSound.vbs")
Note that these solutions make use of temp files.
My System SpecsSystem Spec
08 Apr 2015   #5

Win7 64-bit

Excellent - thank you very much Pyprohly. The batchfile is exactly what I was looking for - works perfectly.

Thanks again....
My System SpecsSystem Spec
07 Mar 2016   #6

Windows 7 Ultimate 32-bit

One other way is to search for the PID of the rundll32.exe instance that is running the mmsys.cpl module
tasklist /M mmsys.cpl /FI "IMAGENAME eq rundll32.exe"
then you can safely kill the correct process using taskkill

taskkill /F /PID <pid>
My System SpecsSystem Spec

Thread Tools

Similar help and support threads
Thread Forum
Run "cmd.exe" as a given user and "as administrator" in command line
Hello and thank you for reading my post. If I'm logged in Windows as user "u1", I can execute "cmd.exe" "as administrator" by choosing "Start" -> "cmd.exe" and right-click "Run as administrator".I would like to start another "cmd.exe" console as "u2" and "as administrator". (So, "u2" is not...
General Discussion
When I open "My Computer" or "Control Panel" nothing displays.
Hello everyone, I've run into an issue that I can't seem to find answer to on the net. When I open My Computer, Control Panel or any folder no files or directories display, after first there is a green loading bar on the address bar and little magnifying glasses (searching icon) on the...
Hardware & Devices
Command Line Open Control Panel\All Control Panel Items
How to open "All Control Panel Items" from the command line? thanks...
General Discussion
"Mail to" shortcut in Send To context menu fails command line argument
Hi All, Previous PC was an XP and we had a shortcut within the Send To context menu called "Mail To" which when clicked on a file would open a new email with the file attached and with the default email (as done from within Outlook), not the crappy text "mail recipient" one that is standard in...
Browsers & Mail

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 07:53.
Twitter Facebook