Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Closing desktop created by DESKTOP command

Jul
68
1
I was just experimenting with the DESKTOP command (running Windows 10 Pro, and TCC v26.02.43). The documentation says that the desktops created in Windows 10 are just "virtual" desktops, so I wanted to see what it was like to create a "real" desktop via TCC. The desktop was created successfully and I can successfully switch between the two using the DESKTOP command, but now I want to know how I can close the new desktop that I created.
 
Good to know. I haven't been keeping up on the forums lately, but I was playing around with "desktops" in Windows 10 and looked in the TCC documentation about the DESKTOP command. I had tried it in Windows 8.1, but it caused problems. I tried it again now in Windows 10 (thinking there was a difference between "virtual" desktops and the ones that TCC creates), and it actually worked, but discovered that it doesn't work totally properly.
 
Is a binary available (I couldn't find one) or do you have to build it yourself?
Nope, you must build it yourself.

All you have to do is run the Compile.bat
Code:
@echo off
:: Markus Scholtes, 2020
:: Compile VirtualDesktop in .Net 4.x environment
setlocal

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe "%~dp0VirtualDesktop.cs" /win32icon:"%~dp0MScholtes.ico"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe "%~dp0VirtualDesktop1803.cs" /win32icon:"%~dp0MScholtes.ico"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe "%~dp0VirtualDesktop1607.cs" /win32icon:"%~dp0MScholtes.ico"

:: was batch started in Windows Explorer? Yes, then pause
echo "%CMDCMDLINE%" | find /i "/c" > nul
if %ERRORLEVEL%==0 pause

Joe
 
Nope, you must build it yourself.

All you have to do is run the Compile.bat
Code:
@echo off
:: Markus Scholtes, 2020
:: Compile VirtualDesktop in .Net 4.x environment
setlocal

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe "%~dp0VirtualDesktop.cs" /win32icon:"%~dp0MScholtes.ico"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe "%~dp0VirtualDesktop1803.cs" /win32icon:"%~dp0MScholtes.ico"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe "%~dp0VirtualDesktop1607.cs" /win32icon:"%~dp0MScholtes.ico"

:: was batch started in Windows Explorer? Yes, then pause
echo "%CMDCMDLINE%" | find /i "/c" > nul
if %ERRORLEVEL%==0 pause

Joe
Yup, that's what I did. I had no idea that I couild build anything in C#. What do you do with a command line interface to virtual desktops? Win-Ctrl-D, Win-Ctrl-Left/Right, and Win-Ctrl-F4 do all I want.
 
What do you do with a command line interface to virtual desktops? Win-Ctrl-D, Win-Ctrl-Left/Right, and Win-Ctrl-F4 do all I want.
I can remove a VirtualDesktop via the command line, when I've done something that is non-conformant;
Code:
e:\utils>VirtualDesktop.exe /remove:1
Removing virtual desktop number 1 (desktop 'Desktop 2')

Joe
 
It's interesting how the command line arguments form a "pipeline" (as the skimpy help says) with the desktop_in_question being automatically passed from argument to argument. I called the executable VD.EXE and came up with this one.

Code:
start devenv & delay 2 & vd /N /MW:%@pid[devenv.exe] /S

That is, start devenv, wait a bit, create a new desktop, move devenv to it, and switch to it
 
... and I just realized that that could be done more simply (and more logically):

Code:
vd /n /s & start devenv

It's a little odd how TCC (on a hidden desktop after vd /n /s) starts devenv on the (new) visible desktop.
 
It's a little odd how TCC (on a hidden desktop after vd /n /s) starts devenv on the (new) visible desktop.
I was single-stepping through the VirtualDesktop.cs code (using CS-Script) in Visual Studio 2019, and it seems (as @rconn said previously) that Microsoft keeps changing the way they handle Virtual Desktops.

Way above my C# abilities, which is why I only use C# for scripting.

The author has also written a module that provides management of Virtual Desktops in PowerShell.

Joe
 

Similar threads

Back
Top