You can't catch key events in non-gui applications.