Skip to content

Instantly share code, notes, and snippets.

@cowboy
Last active February 22, 2024 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboy/44b2a2def2ae0a2f1de5c65d67689d23 to your computer and use it in GitHub Desktop.
Save cowboy/44b2a2def2ae0a2f1de5c65d67689d23 to your computer and use it in GitHub Desktop.
bash script in a Windows cmd file, so you can double-click and run right from Explorer
:<<"::CMDLITERAL"
@echo off
FOR /F "tokens=* USEBACKQ" %%F IN (`wsl wslpath '%~f0'`) DO (
SET script_path=%%F
)
bash -c "'%script_path%'"
exit /b
::CMDLITERAL
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
cd "$SCRIPT_DIR"
your_bash_code_goes_here
@timothyferriss
Copy link

The Bash code you want to execute should replace the placeholder your_bash_code_goes_here immaculate grid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment