fix get_command_name() issue

This fixes #128.
Additionally, use exepath() if available. (exepath() was added by 7.4.235.)