Switching virtual desktop using a command prompt or Visual Basic script. RRS feed

  • Question

  • I know it's possible to switch between virtual desktops using Ctrl + win + arrows or win + tab. However I'm looking for a way to do this using Visual Basic or the command prompt. first I thought of using the SendKey() command in visual basic, but you can't send the win key. Also using  Ctrl + Esc instead won't work because I can't use the Ctrl key again then.

    Is there a command or visual basic script to switch between desktops?

    Thanks in advance,


    Sunday, November 6, 2016 1:21 PM


All replies

  • You can post your question in MSDN forums. 

    Arnav Sharma | Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Sunday, November 6, 2016 10:16 PM
  • Hi Julian,

    Since this issue is aiming on Script. I would help you move this thread to Script forum. You would get more professional help from that forum.

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Monday, November 7, 2016 6:17 AM
  • This cannot be done with VBcript.


    • Marked as answer by Julian1620 Monday, November 7, 2016 3:30 PM
    Monday, November 7, 2016 7:43 AM
  • Could this be done with powershell? I don't know if I want to learn that scripting language.
    Monday, November 7, 2016 10:03 AM
  • Could this be done with powershell? I don't know if I want to learn that scripting language.

    No.  You might be able to do it with AutoIt.


    Monday, November 7, 2016 10:21 AM
  • Is Autolt better then Auto Hot Key?
    Monday, November 7, 2016 11:44 AM
  • Sorry - this isn't a third-party software support forum. You can install those third-party applications and test them to see which of them better meets your needs.

    -- Bill Stewart [Bill_Stewart]

    Monday, November 7, 2016 3:28 PM
  • I ended op using AHK and found a dirty trick to get what I wanted. Thanks for the help
    Monday, November 7, 2016 3:30 PM
  • How did you achieve this? All I want is a .cmd .exe or .lnk file that switches my desktop to left or right. Then integrating it to Rainmeter I would be able to do the desktop switch when moving the mouse to the right/left Side of the Display. This would be dope.
    Tuesday, February 27, 2018 9:28 PM