10

Is there a way from the command line (wmic, regedit, or dedicated tool) to check how many Virtual Desktops in Windows 10 are active, in which a window is, and which one the computer is currently using?

3 Answers 3

8
+100

Use the IVirtualDesktopManager interface to construct a (command line) application to monitor the current status of virtual desktop windows.

Virtual Desktop Switching in Windows 10 (Windows SDK Support Team Blog)

IVirtualDesktopManager

To go along with the addition of virtual desktops in Windows 10, a new shell interface was introduced called IVirtualDesktopManager. It only has three functions, but those allow you to do many things with virtual desktops and your own application.

IsWindowOnCurrentVirtualDesktop will tell you if your window is on the current virtual desktop. GetWindowDesktopId will give you the ID of the desktop the specified window is on. MoveWindowToDesktop will allow you to move a specified window to a specified desktop.


How many Virtual Desktops are active:

Comments:
Chris Lewis [MSFT]: There unfortunately is not an API to enumerate virtual desktops at this time.

In which a window is

GetWindowDesktopId will give you the ID of the desktop the specified window is on.

Which one the computer is currently using

If you create a new window with no parent, it will be placed on the current virtual desktop. [Call GetWindowDesktopId to get the desktop ID for the new window.]

2
  • 1
    You might want to give a direct download link rather then a blog post. I don't understand the post.
    – Penguinz
    Oct 9, 2015 at 22:01
  • How would one “use the IVirtualDesktopManager interface”? This answer seems to be targeted at people with extensive knowledge about writing C# applications and probably cannot help someone who is asking how to get the current VD from the command line. Aug 6, 2021 at 1:59
1

Call AutoHotkey scripts from the command line (or batch file) to send keyboard presses for Virtual Desktop shortcut keys.

1
  • 4
    What script? How does one write the batch file? I personally know the answer to both these questions but not everyone does. Your current answer is more of a comment then an answer.
    – Ramhound
    Oct 8, 2015 at 15:38
0

Though not really clear, the closest thing you might be referring to is what's called the Task View feature. With it, you can view all open Desktops and apps by pressing the WINDOWS key + Tab and all open windows in all desktops by pressing Alt+Tab. For further info on Task View:

https://redmondmag.com/articles/2014/11/20/windows-10-task-view.aspx

and for a comprehensive list of Windows shortcuts and run commands you can check out:

http://www.groovypost.com/howto/windows-10-keyboard-shortcuts/

1
  • The command line request is precise, however there might be a way of accomplishing something similar thing by other means, as I point out. I wasn't certain whether you wanted to know of a way to do it or just a command period. You should specify next time when you ask for something specific the that you wouldn't need to know other details as you're already familiar with them. In this case, if my answer does not provide you any useful information, I can delete it.
    – xCare
    Oct 11, 2015 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .