3

I am wondering if it is possible to save the following operation to a file while the name of the file is the host name:

I mean something like:

ipconfig /displaydns >hostname.txt

For example, in case my PC name is ehh then it will save to ehh.txt file

ehh
  • 135

1 Answers1

4

You want the %computername% environment variable.

So, the command you need is ipconfig /displaydns >%computername%.txt You can find a more complete list of environmental variables in Daniel Beck's answer

Journeyman Geek
  • 133,878