Problem creating and switching to a DESKTOP

Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  26.00.29 x64   Windows 10 [Version 10.0.18362.720]

When I execute the Desktop command it returns;
Code:
e:\utils>desktop
sbox_alternate_desktop_local_winstation_0x2B6C
Default
Winlogon

When I execute the Desktop command with options;
Code:
desktop /c /n jlc1
it returns a message box
Code:
---------------------------
explorer.exe - Application Error
---------------------------
The application was unable to start correctly (0xc0000142). Click OK to close the application.
---------------------------
OK  
---------------------------

I click OK, and I'm back at the TCC Prompt.

So, I create a new desktop via Windows 10
1587158703209.png


However, when I run Desktop to switch to "Desktop 2", I get
Code:
desktop "Desktop 2"
TCC: (Sys) The system cannot find the file specified.
 "Desktop 2"

Executing Desktop returns;
Code:
sbox_alternate_desktop_local_winstation_0x2B6C
Default
Winlogon
but does not list the "Desktop 2" that I created with Windows 10.

I have no problem to switch among the Desktops using the Win+Tab key, and then selecting the Desktop from that screen.

Joe
 
May 20, 2008
10,678
83
Syracuse, NY, USA
DESKTOP gives me

Code:
v:\> desktop
sbox_alternate_desktop_local_winstation_0xE5C
Default

"DESKTOP /C new_desktop" takes me to a new desktop which is nearly totally unfunctional. The start button doesn't work. Neither does Win+Tab (task view, so I can get back to the original desktop). Neither does Win+R. I had to C-A-D logoff. It seems like a real mess!

Alternative desktops work fine if I use the Windows built-in mechanisms.
 

rconn

Administrator
Staff member
May 14, 2008
11,954
133
DESKTOP gives me

Code:
v:\> desktop
sbox_alternate_desktop_local_winstation_0xE5C
Default

"DESKTOP /C new_desktop" takes me to a new desktop which is nearly totally unfunctional. The start button doesn't work. Neither does Win+Tab (task view, so I can get back to the original desktop). Neither does Win+R. I had to C-A-D logoff. It seems like a real mess!

Alternative desktops work fine if I use the Windows built-in mechanisms.

Why didn't you use DESKTOP to switch batch to your original desktop?
 
Here's a C# program with source code, which creates VirtualDesktop.exe, which allows working with Virtual Desktops from the command line.

Examples:
Code:
Virtualdesktop.exe -New -Switch -GetCurrentDesktop
Virtualdesktop.exe sleep:200 gd:1 mw:notepad s
Virtualdesktop.exe /Count /continue /Remove /Remove /Count
VirtualDesktop.exe -IsWindowPinned:cmd
if ERRORLEVEL 1 VirtualDesktop.exe PinWindow:cmd

Ref: MScholtes/VirtualDesktop

Joe
 
Here's a PowerShell solution with source for working with Virtual Desktops.

Examples:
Code:
# Load commands (assumes VirtualDesktop.ps1 is in the current path) 
. .\VirtualDesktop.ps1 
 
# Create a new virtual desktop and switch to it 
New-Desktop | Switch-Desktop 
 
# Get second virtual desktop (count starts with 0) and remove it 
Get-Desktop 1 | Remove-Desktop 
 
# Retrieves the count of virtual desktops 
Get-DesktopCount 
 
# Move notepad window to current virtual desktop 
(ps notepad)[0].MainWindowHandle | Move-Window (Get-CurrentDesktop) | Out-Null 
 
# Move powershell window to last virtual desktop and switch to it 
Get-Desktop ((Get-DesktopCount)-1) | Move-Window (Get-ConsoleHandle) | Switch-Desktop 
 
# Retrieve virtual desktop on which notepad runs and switch to it 
Get-DesktopFromWindow ((Get-Process "notepad")[0].MainWindowHandle) | Switch-Desktop 
 
# Pin notepad to all desktops 
Pin-Window ((Get-Process "notepad")[0].MainWindowHandle)

Ref: TechNet Powershell commands to manage virtual desktops of Windows 10

Joe
 

rconn

Administrator
Staff member
May 14, 2008
11,954
133
Windows 10 Virtual Desktops have nothing in common with the DESKTOP command, which uses a different (10-year-old) technology intended for Windows 7. (DESKTOP was introduced in Take Command v14.)

At this point, the internal DESKTOP command is deprecated for Win 10, and will either be removed or rewritten to support the new Windows 10 Virtual Desktops.
 
At this point, the internal DESKTOP command is deprecated for Win 10, and will either be removed or rewritten to support the new Windows 10 Virtual Desktops.

This is from the README.md of the C# program that I noted in post #5:
With Windows 10 1809 Microsoft changed the API (COM GUIDs) for accessing the functions for virtual desktops again.

I provide three versions of virtualdesktop.cs now:

virtualdesktop.cs is for Windows 10 1809 and newer,
virtualdesktop1803.cs is for Windows 10 1803,
virtualdesktop1607.cs is for Windows 10 1607 to 1709 and Windows Server 2016.

Does Take Command support all versions of Windows 10, back to 1507?

Ref: Windows 10 version history - Wikipedia

Joe
 

rconn

Administrator
Staff member
May 14, 2008
11,954
133
Take Command supports all version of Windows 10.

TCC doesn't support the virtual desktops because Microsoft has declined to document the necessary api's. They only documented one top-level COM interface that can only move a window to a desktop or tell which desktop the window is on.

Microsoft did add support for .NET apps to access most of the virtual desktop functionality, but everybody else is out of luck. And as long as they keep changing it, they're unlikely to document it.