Clone this repo:


  1. 76626ae Merge pull request #1 from sethwklein/blog-link by Alan Shreve · 4 years, 8 months ago master v1.0 v1.0.0
  2. d658309 Link "Sweat the small stuff" post by Seth W. Klein · 4 years, 8 months ago
  3. ac2cd66 add license by Alan Shreve · 4 years, 9 months ago
  4. b4f7ad8 add 1.4 implementation by Alan Shreve · 4 years, 9 months ago
  5. d4be545 don't panic on non-windows platforms. add doc to non-windows file so it shows up in godoc by Alan Shreve · 5 years ago


mousetrap is a tiny library that answers a single question.

On a Windows machine, was the process invoked by someone double clicking on the executable file while browsing in explorer?


Windows developers unfamiliar with command line tools will often “double-click” the executable for a tool. Because most CLI tools print the help and then exit when invoked without arguments, this is often very frustrating for those users.

mousetrap provides a way to detect these invocations so that you can provide more helpful behavior and instructions on how to run the CLI tool. To see what this looks like, both from an organizational and a technical perspective, see

The interface

The library exposes a single interface:

func StartedByExplorer() (bool)