Hi JonathanTodd6,
Good day! This is Jhakesong and I will be happy to assist you with this.
I am sorry to hear about the inconvenience. Give this power shell script a try and see if it suits your needs in closing the virtual desktops at once.
Copy and paste this code in a notepad and save it as a .ps1 file and run it with powershell.
Function CloseVirtualDesktopInWin10
{
$KeyShortcut = Add-Type -MemberDefinition @"
[DllImport("user32.dll")]
static extern void keybd\_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
//WIN + CTRL + F4: Close the virtual desktop
public static void CloseVirtualDesktopInWin10()
{
//Key down
keybd\_event((byte)0x5B, 0, 0, UIntPtr.Zero); //Left Windows key
keybd\_event((byte)0x11, 0, 0, UIntPtr.Zero); //CTRL
keybd\_event((byte)0x73, 0, 0, UIntPtr.Zero); //F4
//Key up
keybd\_event((byte)0x5B, 0, (uint)0x2, UIntPtr.Zero);
keybd\_event((byte)0x11, 0, (uint)0x2, UIntPtr.Zero);
keybd\_event((byte)0x73, 0, (uint)0x2, UIntPtr.Zero);
}
"@ -Name CloseVirtualDesktop -UsingNamespace System.Threading -PassThru
$KeyShortcut::CloseVirtualDesktopInWin10()
}
Function CloseAllVirtualDesktopInWin10() {
$maxNumber=1..800
foreach ($n in $maxNumber)
{
CloseVirtualDesktopInWin10
}
}
CloseAllVirtualDesktopInWin10
Here is how to use it:
https://www.addictivetips.com/windows-tips/clos...
Reference:
https://www.reddit.com/r/techsupport/comments/a...
Note:
- Press Windows key + X, launch Windows Powershell Admin
- Paste this command and press enter:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
- Right click your .ps1 file and run it with Powershell.
Let me know how it goes. Have a great day!
____________________________________________________________
Standard Disclaimer: These are links to non-Microsoft websites. The pages appear to be providing accurate, safe information. Watch out for ads on the sites that may advertise products often classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the sites before you decide to download and install it. We strongly suggest not to install or purchase anything from the link.