How to create command in module?

Hi!

How to create CConsoleCommand in module? Is there a way to do it?

UPD

I create this structure :

Config in affiliate_cron.php is pointing to this :


$config=dirname(__FILE__).'/protected/modules/affiliate/config/cron.php';

Command "php.exe affiliate_cron.php stats" is running, but my module is using model, that placed in /protected/models/, so error appeared :


2010/09/28 13:11:32 [error] [php] YiiBase::include(Downloads.php): failed to open stream: No such file or directory (c:\yii\framework\YiiBase.php:338)

Tried to add application models to import section in affiliate/config/cron.php, but nothing changed :


'import' => array(

    'application.models.*',

  ),

How can I include (import) Downloads.php to module?

Thanks.

Does anyone have an answer for this? I’m looking to do the same.