How to add websites to HOSTS file

Hi there,

Regarding the use of the HOSTS file in Windows 7 to block ads and unwanted tracking cookies:

I would like to block everything and anything from the doubleclick.net server. I understand that I could add these lines to the HOSTS file:

127.0.0.1 ad.doubleclick.net
127.0.0.1 googleads.g.doubleclick.net

etc,etc.

How can I use a single line to block all contents from the doubleclick.net domain? (ie *.doubleclick.net)

I have tried using
127.0.0.1 *.doubleclick.net AND
127.0.0.1 doubleclick.net
but it does not work.

Another example is that I would like to block all contents from imrworldwide.com, including secure-au.imrworldwide.com, secure-nz.imrworldwide.com etc.

Thanks.

Unfortunately, wildcards are not allowed in the hosts file and neither are domain separators such as / \ etc. If you want to use the hosts file for ad blocking, you can add up to 9 entries per line. For example:

127.0.0.1 doubleclick.com doubleclick.net ad.doubleclick.net ad.us.doubleclick.net ad.uk.doubleclick.net etc.

Thanks Radaghast for your answer.