Created
April 13, 2018 21:17
-
-
Save DzeryCZ/aa0063c3143c2f69d7469285bbd0567f to your computer and use it in GitHub Desktop.
Run Windows Programs (.exe) from WSL as Fallback without extension
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
# Add at the end of your ~/.bashrc file this content: | |
# Run Windows Programs (.exe) from WSL as Fallback without extension | |
eval "$(echo "orig_command_not_found_handle()"; declare -f command_not_found_handle | tail -n +2)" | |
command_not_found_handle() | |
{ | |
cmd=$1 | |
shift | |
args=( "$@" ) | |
IFS=: | |
for dir in $PATH; do | |
for executable in $dir/$cmd.exe $dir/$cmd.com $dir/$cmd.bat; do | |
if [ -x $executable ]; then | |
"$executable" "${args[@]}" | |
return | |
fi | |
done | |
done | |
orig_command_not_found_handle "$cmd" "${args[@]}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment