WINDOWS PROMPT Getting IP of webpages from file

前端 未结 2 1660
迷失自我
迷失自我 2020-12-12 07:20

I have to get IP of webpages that I\'ll deliver from txt file: for example txt file looks like:

google.com
yahoo.com
toyota.com
bmw.com
etc...
2条回答
  •  隐瞒了意图╮
    2020-12-12 08:14

    I know this is a PowerShell answer to a batch question, but I find that many people ask how to do things in batch when they are really just wanting a command line. If you are wanting to learn how to do things like this, learn PowerShell instead of batch as it is much easier to learn than the convoluted batch FOR command (my apologies to those of you who actually understand it).

    get-content c:\temp\test.txt | foreach-object{ping ([System.Net.Dns]::GetHostAddresses("$_")[0].IPAddressToString)}
    

提交回复
热议问题