On A Windows machine, you can use the netsh command.
netsh interface ip set dns name="Local Area Connection" static 208.67.222.222
All the steps below means you have access to the router via Telnet or physical access and it already has a valid configuration (except the DNS)
On a Cisco Router is:
Step 1: enable
Step 2: configure terminal
Step 3: Do one of the following: ip domain name name
ip domain list name
Step 4 : Device(config)# ip name-server 172.16.1.111 172.16.1.2