When there is a DNS query, what do windows checks first - host file or DNS cache ? In linux I can change my preference using nsswitch.conf. Is there something similar in windows.
They are both tied together in Windows. The displaydns command will show entries that are in the hosts file too. Here's a link to an MS article that explains how it works:
The ipconfig /displaydns command provides you with a means to view the contents of the DNS client resolver cache, which includes entries preloaded from the local Hosts file, as well as any recently obtained resource records for name queries resolved by the system. This information is used by the DNS Client service to quickly resolve frequently queried names before it queries its configured DNS servers.