Start WSL GUI apps without command prompt
---date: Apr 20, 2018
tags:
- WSL
- GUI
language: English
---
This post is more than 8 years old. If this is a technical post, the post will most likely not working, but feel free to try it and see if it works.
When using this method to start application from desktop, a command prompt will always started at the back:

So there is a solution to the problem to stop command prompt to be shown along the apps.
Firstly, create a file with name runHidden.vbs with following content (CRLF style required), and place it at some proper place:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ' Simple command-line help. select case WScript.Arguments(0) case "-?", "/?", "-h", "--help" WScript.echo "Usage: runHidden executable [...]" & vbNewLine & vbNewLine & "Runs the specified command hidden (without a visible window)." WScript.Quit(0) end select ' Separate the arguments into the executable name ' and a single string containing all arguments. exe = WScript.Arguments(0) sep = "" for i = 1 to WScript.Arguments.Count -1 ' Enclose arguments in "..." to preserve their original partitioning. args = args & sep & """" & WScript.Arguments(i) & """" sep = " " next ' Execute the command with its window *hidden* (0) WScript.CreateObject("Shell.Application").ShellExecute exe, args, "", "open", 0 |
Then you can launch your GUI application using the command below:
1 | > wscript Address\to\runHidden.vbs bash -c <GUI application> |
This feature will also be included in the future release of wslu.
Source: https://stackoverflow.com/questions/41225711/wsl-run-linux-from-windows-without-spawning-a-cmd-window Credit to mklement0
