Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open "Devices and Printers" Control Panel in Windows 8 via CLI or AHK? [closed]

I would like to automate connecting PC to phone's internet connection via Bluetooth using the AutoHotKey script which will perform the following actions:

Bluetooth internet connecting UI sequence

Once the Devices and Printers window is open, I should be safely able to finish most of actions by sending keystrokes.

Now the question:

In Windows 7, Devices and Printers can be open via command line

control bthprops.cpl

but in Windows 8 the same command opens Modern UI screen PC Settings > Devices instead of the above window. Is there a way to open the above window programatically either via command line or via DLL call?

like image 696
miroxlav Avatar asked Feb 07 '14 10:02

miroxlav


People also ask

How do I open Devices and Printers from the command prompt?

Simply press the Windows key + R shortcut to bring up the Run dialog, or open the Command Prompt. Type control printers and press Enter. The Devices and Printers window will open immediately.

Where can I find Bluetooth in CMD?

In this case, use Windows command prompt: Type cmd in the Windows search bar and press the [Enter] key. In the window that opens, enter the command net start "bthserv” and press the [Enter] key to confirm.


1 Answers

OK, after some further research, I have found working command:

control printers

It opens window Devices and Printers, containing not only Bluetooth devices, but all known devices. So content of the window is superset of content requested in the question, but the only difference is that filtering of Bluetooth devices is not applied this time. Typing name of the device moves selection focus to its item and nothing stands in way of running command from context menu of the device. The complete script for sample device MyPhone1 therefore is:

Run, control printers
WinWaitActive, Devices and Printers
Sleep, 500
Send MyPhone1{AppsKey}ca

And the AutoHotKey rules again. :)

Edit: Upon MCL's comment, ugly waiting loop was replaced by sleek WinWaitActive. Thanks!


EDIT:

from command line:

  • devices and printers:

    explorer shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}
    
  • bluetooth devices:

    explorer shell:::{28803F59-3A75-4058-995F-4EE5503B023C}
    
  • other locations:

    ▶ list at eightforums.com

like image 159
miroxlav Avatar answered Sep 21 '22 18:09

miroxlav