Start programs on specific desktops, switch to other desktops and query the current desktop from the command line.
Note:
  • Sysinternal's Desktops needs to be running.
  • Executing a program on, or switching to a desktop that has not been created yet, results in failure.
    Either create the desktop as usual via Desktops or with DesktopsUtil's i/I-parameter.

Parameters

DesktopsUtil.exe [cmd]

g (get)
  Get the ID of the current desktop (1-4)
  If the current desktop is not the active one,
  the number is negative

a (active)
  Get the ID of the currently active desktop

l (list)
  Show a list of the currently available desktops
  in a message box

s<ID> (switch)
  Switch to the specified desktop
  <ID> is a number from 1-4

i<ID> (init)
  Initialise a specific desktop

I<ID> (init)
  Initialise a specific desktop and switch to it
  afterwards

e<ID> <COMMAND> (execute)
  Execute command on the specified desktop

E<ID> <COMMAND> (execute)
  Execute command on the specified desktop and switch
  to it afterwards


Examples


REM run Firefox if the current desktop is #1 and active DesktopsUtil g if %ERRORLEVEL% EQU 1 firefox.exe
REM switch to desktop #4 DesktopsUtil s4
REM initialise and switch to desktop #3 DesktopsUtil I3
REM execute explorer.exe on desktop #2 DesktopsUtil e2 explorer.exe
REM execute calc.exe on desktop #3 and switch to it DesktopsUtil E3 explorer.exe
REM execute notepad.exe on the currently active desktop DesktopsUtil a DesktopsUtil e%ERRORLEVEL% notepad.exe

Download