I'd be surprised if you can find a satisfactory way to do it. If you try NetWallah's suggestion of slogging through history, you may find that the user put a blank before the command and has history suppressing lines beginning with blanks. The user could be running in a number of different shells, so shell trickery could be similarly difficult. So knowing which quotes to use, and/or whether there's any path prefix is added would be quite a trick.
When your only tool is a hammer, all problems look like your thumb.