

Please note that you must not specify the ".bat" file extension and the batch file must exist in the same folder as the "bat-launcher.vbs" ( i.e., 'C:\wsl' in this example). For example, if your batch file is named " start-ubuntu-xfce-desktop.bat", you need to enter the following for the shortcut: wscript.exe "C:\wsl\bat-launcher.vbs" "start-ubuntu-xfce-desktop" Please replace the " " with your batch file created in Step 3. STEP 5 Create a Windows shortcutįor the location of the item, you should enter the following: wscript.exe "C:\wsl\bat-launcher.vbs" ""

Please note that the above VBScript automatically attaches the ".bat" file extension to its first argument and executes it as if it's a batch file in the same folder. STEP 3 Create a Windows batch file (*.bat) for launching your Linux GUI desktopĬ:\wsl\bat-launcher.vbs If 1 ThenĬreateObject("WScript.Shell").Run """" & bat & """ """ & arg & """", 0, False However, we're primarily using the VBScript in order to hide the Command Prompt window that pops up whenever a batch file is executed. You can of course directly launch the batch file. We're using a VBScript file to launch the actual batch file that sets up and starts the Linux GUI desktop. If you've decided to use a different folder path, please make adjustments accordingly in the next steps. It can be any folder on any drive, but for the sake of simplicity, let's create it on C: drive and name it 'wsl': c:\wsl. STEP 2 Create a folder for WSL related scripts and assets STEP 1 Find a Linux command line for your GUI desktopĮach Linux GUI desktop has its own startup executable and you need to find it along with its required command line arguments for WSL.įor example, you can use the following command line to launch the Xfce4 desktop on Ubuntu 18.04: export DISPLAY=127.0.0.1:0.0 xfce4-session

Once you've managed to successfully start a Linux GUI desktop environment, you can create a Windows shortcut that can be pinned to Start or taskbar.

Pin a Linux GUI app to Start or Taskbar.Directly opening Linux GUI apps from Windows batch files.Where should I add my DISPLAY environment variable in WSL?.
