如何编写一个将执行另一个批处理文件的批处理文件?

时间:2019-09-26 17:23:00

标签: batch-file scripting

我有一个文本文件,其中包含约200个服务器名称的列表,并且我有一个批处理文件,该文件将提供与服务器上托管的IIS站点有关的输出。

我尝试了示例批处理文件,但对我不起作用。

这是我用来获取与服务器有关的所有iis站点信息的批处理文件。

(net config workstation | findstr /C:"Full Computer name"
________________________________________
@ipconfig /all | find "IP Address" 
@ipconfig /all | find "IPv4 Address" 
@ipconfig /all | find "Subnet Mask" 
@ipconfig /all | find "Default Gateway" 
@ipconfig /all | find "Host Name" 
@ipconfig /all | find "DNS Suffix Search List" 
@ipconfig /all | find "Physical Address" 
@ipconfig /all | find "DHCP Enabled" 
@ipconfig /all | find "DHCP Server"
_________________________________________
cd c:\Windows\system32\inetsrv
appcmd list site
appcmd list apppool) > c:\IISSiteBindings.txt

我需要一个批处理文件,该批处理文件将调用包含服务器名称列表的文本文件,并且对于每个服务器,该批处理都需要执行上述脚本文件以在文本文件中获取与服务器有关的所有信息。格式化为输出。

1 个答案:

答案 0 :(得分:0)

在一个批处理文件中,您需要做的就是调用另一个批处理文件:

call batchfile.bat