Carrying on from Ali Farhoudi answer.
You need to use authorisation of $this->input->is_cli_request()
https://ellislab.com/codeigniter/user-guide/general/cli.html
The is_cli_request() will make sure that you are running the command from the server, IE no one has just navigated to that URL and ran the script.
Most hosting services have an easy method to do this (run a cron). You may find a bit of trial and error at first, as your development server will probably differ to production. So what works on your machine to run a script at terminal / whatever, won't be the same as the server for obvious reasons.
So its just a controller like any other, that you server, at a given time, runs.
Mine look something like this, set inside a cron
php-cli /home/a_subfolder/public_html/another_subfolder/myscript.php
This is running on a Linux server, so the codeigniter question part is above, how you run a cron in windows, don't know / care
check this.
What is the Windows version of cron?
I'm guessing your running this locally only then? Judging by windows 10.