Last active
March 4, 2019 18:24
-
-
Save chponte/e17a5cc5b233439f1afa670469b24265 to your computer and use it in GitHub Desktop.
WSL Shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Target: C:\Windows\System32\wscript.exe "path\to\launcher.vbs" "ubuntu1804.exe" "run" "command" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment