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 hidden or 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 used this script since last year. (Many thanks!) After i upgraded my windows to 11 it stopped working and i cant seem to find the problem.
Do you have any experience with terminator wsl2 and windows 11?
Giant PITA!
i used this script since last year. (Many thanks!) After i upgraded my windows to 11 it stopped working and i cant seem to find the problem. Do you have any experience with terminator wsl2 and windows 11?
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
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
Automatically retrieve the ip address related to your WSL2 adapter using adapter name in the function
GetIpFromAdapter
, in VBS :