How to create shareware demo?

Is there a simple, preferably free solution to create a shareware demo of a file.

Specifically, what if someone wanted to:

  1. distribute a type of software executable file (exe).
  2. allow the file to be installed on the persons system.
  3. after a trail period has elapsed the software will ask for a registration key that the user must purchase.

Is there a tool like that available?