Command line to "Close Control Panel Applet"?

EssKayKay

Distinguished
Aug 31, 2011
60
1
18,535
Hello,

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?

Thanks,
SKK
 

EssKayKay

Distinguished
Aug 31, 2011
60
1
18,535
There were two suggestions. I tried them - they both worked fine:

Here's the link -
http://www.sevenforums.com/general-discussion/366601-command-line-close-control-panel-applet.html#post3041806


1. First -

"%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"


2. Second -

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")