This script is optimized for use with Media Portal. 
It can be adapted with ease to other TV software.

Get xmltv.exe from the officiel source: http://sourceforge.net/projects/xmltv/files/xmltv/

Enter the folder for the latest version and download the Windows binaries - those are the one with xmltv-x.x.x-win32.zip

Unzip to a folder called "xmltv".
Copy the two files "Grab_xmltv.cmd" and "sed.exe" into the "xmltv" folder.

Move the "xmltv" folder into the "Program Files" on the c-drive.
In 64-bit Windows it is called "Program Files (x86)"
Administrative rights are required.

Run the script: "Grab_xmltv.cmd"

The script will create the required files if they don't exist on the system

When asked for a URL - Enter the following for Denmark: http://xmltv.xmltv.se/channels-Denmark.xml.gz

When asked for a directory to store cache then press "enter" to select a path under the user or enter the following:
C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\Cache

When asked for the different channels. Choose the ones you need with "yes" or choose "all"
(it will take less time to download a selected few channels compaired to all of the channels)

It will then download all the selected channels for the next 14 days and place them in tvguide.xml in the path:
C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv

The script is now configured and will download tv data for the next 14 days when run.


Extra:
Media Portal default path is used but can easily be changed in the script.

Edit the "tv_grab_se_tvzon.conf" in the same folder as tvguide.xml to change the selection of channels.

Create a scheduled task to run the script every day and use "Run task as soon as possible afster a schedules start is missed"