Created
September 29, 2017 00:02
-
-
Save ropnop/10800fb5066bd5144d9aaad55a8a4d18 to your computer and use it in GitHub Desktop.
VBS Script to Launch Terminator through WSL
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
args = "-c" & " -l " & """DISPLAY=:0 terminator""" | |
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "", "open", 0 |
I added home directory changes and more reliable IP calculation:
' https://gist.github.com/ropnop/10800fb5066bd5144d9aaad55a8a4d18
set shell = WScript.CreateObject("Shell.Application")
if not IsProcessRunning("vcxsrv.exe") then
shell.shellExecute "vcxsrv.exe", ":0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto", "C:\Program Files\VcXsrv\", "", 0
WScript.Sleep 2000
end if
myCd = "~"
If WScript.Arguments.Length > 0 Then
myCd = "'$(wslpath -u '" & WScript.Arguments(0) & "')'"
End If
args = "bash" & " -c ""cd " & myCd & " ;DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 terminator"""
shell.ShellExecute "C:\Windows\System32\wsl.exe", args, "", "open", 0
Function IsProcessRunning( strProcess )
Dim Process, strObject
IsProcessRunning = False
strObject = "winmgmts://."
For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
If UCase( Process.name ) = UCase( strProcess ) Then
IsProcessRunning = True
Exit Function
End If
Next
End Function
Thanks @fahri314
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Windows 11 does not need this script. When you install a program in wsl, you can find windows start menu with its name and you'll see with icon if exist