在Windows系统上,我正在尝试收集DNS名称的所有IP地址,并使用每个IP地址调用一个工具。 我知道如何在shell脚本中实现它,但不知道如何在批处理或PowerShell文件中实现。
我想将其移植到Windows上。
我想将其移植到Windows上。
#!/usr/bin/env bash
# Get all the IPs for our server instance
# and pass it to "p4 trust" to update the .p4trust file
for address in $(dig perforce.example.com +short)
do
echo "processing address: $address:1666"
p4 -p "ssl:$address:1666" trust -y -f || true
done
问题:
- 是否有预安装的Windows
dig
等效工具,它将仅返回DNS记录的IP地址? - 在批处理或PowerShell文件中,如何循环迭代另一个应用程序的多个结果?