How to? Closing desktop created by DESKTOP command

Jul 29, 2016
49
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.
 
Jul 29, 2016
49
1
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
 
May 20, 2008
11,378
98
Syracuse, NY, USA
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.
 
May 20, 2008
11,378
98
Syracuse, NY, USA
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
 
May 20, 2008
11,378
98
Syracuse, NY, USA
... 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
Thread starter Title Forum Replies Date
vefatica Command line DO with no closing parenthesis? Support 9
aedthuio TCC: No closing quote Support 2
vefatica ON <closing the console> Support 5
T Closing multi-tab TCMD crashes Support 4
S Closing date for V16 suggestions Support 1
Mordachai Fixed Closing TCMD while IDE + Help Open = Crash Support 7
vefatica WAD HISTORY /R, No closing quote? Support 10
M How to? Missing closing quote: What am I doing wrong???? Support 7
vefatica Console not closing ... problem gone Support 1
vefatica Console not closing Support 1
vefatica Closing detached consoles Support 2
vefatica Trouble closing TCMD Support 0
vefatica WINDOW (and more closing TCC woes) Support 15
Steve Pitts Failed REXX invocation not closing file Support 3
vefatica BSOD closing IDE! Support 7
mikea 'Loop' on closing TC Support 6
Joe Caverly Problem creating and switching to a DESKTOP Support 9
R How to? Win 10 virtual desktops and DESKTOP Support 4
D Tcmd 22.00.42 - annoying desktop refresh Support 47
C TC rearranges my desktop! Support 57
P Desktop customization is ignored by v19 Support 5
S Documentation HELP Nit - Index - Desktop command Support 0
D How to? How do you uncreate a Desktop? Support 1
S DESKTOP - identify current active ? Support 4
vefatica (OT) Show desktop from command line? Support 20
vefatica Fixed DESKTOP, START? Support 0
vefatica START /DESKTOP="name with space" ... Support 4
vefatica DESKTOP /N? Support 0
vefatica New desktop and StartUp folder? Support 4
vefatica New desktop, need Explorer PID Support 1
vefatica DESKTOP Support 7
vefatica START /DESKTOP Support 3
vefatica Running TCMD's help on the services desktop Support 0
C starting a shortcut from desktop Support 14
C Desktop Refresh? Support 5
S Desktop Shortcut Hotkey question Support 1
S Desktop hotkey creation using SHORTCUT command Support 4
vefatica Desktop/MyComputer Support 1
Joe Caverly A new guard page for the stack cannot be created Support 6
C 7zip with date range .vs. filelist created with dir and daterange Support 0
G FOLDERMONITOR created also firing for delete (and maybe other events) Support 7
thedave Newly created directories missing from TCMD Support 0

Similar threads