小编Unc*_*evo的帖子

批处理文件 - 循环ping - 输出到已启动的文件主机

我想创建一个.bat文件,它将执行for循环,如下所示:

@echo off
FOR /L %%G IN (1, 1, 69) DO (
    ping -n 1 192.168.%%G.3 
    ping -n 1 192.168.%%G.4
)
Run Code Online (Sandbox Code Playgroud)

然后查看输出并仅将成功回复ping的IP发送到txt文件.这是否可以使用CMD批处理文件?

for-loop cmd ping batch-file

4
推荐指数
1
解决办法
2万
查看次数

DOS批处理文件 - 循环并递增1

我有这个批处理文件,登录到远程机器上的sql运行存储过程,然后将输出发送到文本文件.我希望它将IP地址中的第3个八位字节和输出文本文件的名称递增1并循环,这样我就不必一遍又一遍地重复命令.此外,我希望它达到一定数量时停止.有没有办法做到这一点?

sqlcmd -U user -P password -S 192.168.1.2 -i c:\sql\storecreditfix.sql -o c:\sql\ouput01.txt
sqlcmd -U user -P password -S 192.168.2.2 -i c:\sql\storecreditfix.sql -o c:\sql\ouput02.txt
sqlcmd -U user -P password -S 192.168.3.2 -i c:\sql\storecreditfix.sql -o c:\sql\ouput03.txt
sqlcmd -U user -P password -S 192.168.4.2 -i c:\sql\storecreditfix.sql -o c:\sql\ouput04.txt
sqlcmd -U user -P password -S 192.168.5.2 -i c:\sql\storecreditfix.sql -o c:\sql\ouput05.txt
Run Code Online (Sandbox Code Playgroud)

sql cmd batch-file

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

batch-file ×2

cmd ×2

for-loop ×1

ping ×1

sql ×1