What is a setdns.cmd file and how do you use it?
A setdns.cmd file is a batch script that can be used to set the primary and alternative DNS servers on a Windows machine. This can be useful in a variety of situations, such as when you want to use a specific DNS server for a particular network connection, or when you want to override the DNS servers provided by your ISP.
How do you create a setdns.cmd file?
To create a setdns.cmd file, you will need to open a text editor (such as Notepad) and enter the following commands:
@echo off
cls
set /p primary="Enter Primary DNS: "
set /p alternative="Enter Alternative DNS: "
netsh interface ip set dns name="Local Area Connection" static %primary%
netsh interface ip add dns name="Local Area Connection" %alternative% index=2This script will prompt you to enter the primary and alternative DNS servers, and then it will use the netsh command to set the primary DNS server and add the alternative DNS server to the list of DNS servers for the "Local Area Connection" network connection.
How do you use a setdns.cmd file?
To use a setdns.cmd file, you will need to save the file with a .cmd extension (for example, setdns.cmd) and then double-click on the file to run it. This will open a command prompt window and prompt you to enter the primary and alternative DNS servers.
Once you have entered the DNS servers, the script will set the primary DNS server and add the alternative DNS server to the list of DNS servers for the "Local Area Connection" network connection. You can then close the command prompt window and continue using your computer as normal.
Key concepts
- A setdns.cmd file is a batch script that can be used to set the primary and alternative DNS servers on a Windows machine
- To create a setdns.cmd file, you will need to open a text editor and enter the appropriate commands
- To use a setdns.cmd file, you will need to save the file with a .cmd extension and double-click on it to run it
References
- Microsoft. (n.d.). Netsh interface ip set dns. Retrieved from
- Microsoft. (n.d.). Set command. Retrieved from
This article was created for the purpose of providing detailed information about the setdns.cmd file and how to use it. It is not intended to be used as a page layout or to be split across multiple pages. The HTML output is valid and has been generated using plain HTML tags, without the use of any page layout tags such as div or hr.