diff --git a/README.md b/README.md index 490d8ee..8d0d487 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ A feature-barren DOS clone of `ls` that hides Windows hidden files. Relies on ## Scripts +- `cmd.sh`: Simple wrapper for `cmd.exe`. - `dos.sh`: Simple wrapper for executing Windows commands directly. - `elevate.sh`: Elevate WSL (`-l`) or Windows (`-w`) commands from WSL. - `explorer.sh`: Launch explorer from WSL. diff --git a/scripts/cmd.sh b/scripts/cmd.sh new file mode 100755 index 0000000..9f8c09d --- /dev/null +++ b/scripts/cmd.sh @@ -0,0 +1,21 @@ +#!/usr/bin/bash + +if [ "$#" -eq 0 ]; then + args='' + for arg in $@; do + if [[ $arg =~ ^-.+$ ]]; then + transform=(${arg//-//}) + if [[ $arg =~ ^-.+=.+$ ]]; then + transform=(${transform//=/:}) + fi + args="$args $transform" + else + args="$args $arg" + fi + done + + /mnt/c/Windows/System32/cmd.exe $args +else + /mnt/c/Windows/System32/cmd.exe +fi + diff --git a/scripts/justfile b/scripts/justfile index 5f687ea..bb71ad0 100644 --- a/scripts/justfile +++ b/scripts/justfile @@ -2,6 +2,7 @@ alias i := install install DIR="~/.bin": + cp cmd.sh {{DIR}}/cmd cp dos.sh {{DIR}}/dos cp elevate.sh {{DIR}}/elevate cp explorer.sh {{DIR}}/explorer