Created
November 17, 2023 21:26
-
-
Save casperklein/bad8c368c338e5d79b88b9229251aad1 to your computer and use it in GitHub Desktop.
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
| @echo off | |
| REM Run bash scripts in WSL with up to 8 arguments on double click. First argument is the file name. | |
| REM Registry: "Computer\HKEY_CLASSES_ROOT\sh_auto_file\shell\open\command" --> D:\Scripts\BashLauncherV2.bat "%1" "%2" "%3" "%4" "%5" "%6" "%7" "%8" "%9" | |
| REM Source: https://superuser.com/a/1702441/563747 | |
| REM https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/call | |
| REM %~1 --> Expands %1 and removes surrounding quotation marks. --> This allows calling bash scripts with quoted arguments: ./travel.sh "New York" | |
| wsl -e bash -l -c "\"$(wslpath '%1')\" '%~2' '%~3' '%~4' '%~5' '%~6' '%~7' '%~8' '%~9'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment