WSL x11 via run cmd

MS 20 Reputation points
2023-08-18T13:13:24+00:00

Opening a cmd window and typing "Debian" and then "xeyes" works properly.

Running "cmd /k Debian run xeyes" in a batch returns "Error: Can't open display:"

System is Win11 22H2 with Debian11 on WSL v1

I use VcXsrv and "export DISPLAY=:0.0" in the .profile

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 44,751 Reputation points
    2023-08-21T10:43:01.1+00:00

    Hello MS,

    Thank you for your question and for reaching out with your question today.

    It sounds like you're trying to run graphical applications from the Windows Subsystem for Linux (WSL) with a display using VcX srv. Make sure that VcX srv is running and configured properly to allow connections from the WSL. Ensure that VcX srv's display is set to :0 or :0.0.

    You may also consider upgrading to WSL 2 as it has better support.

    You may also want to try this slightly different command:

    export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv .conf 2>/dev/null):0

    If the reply was helpful, please don’t forget to upvote or accept as answer.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.