找回密码
 加入
搜索
查看: 2655|回复: 8

[AU3基础] _rundos 我想写个PING命令(已解决)

  [复制链接]
发表于 2012-11-8 22:29:18 | 显示全部楼层 |阅读模式
本帖最后由 chasedream 于 2012-11-9 10:19 编辑

我想用au3实现ping功能

_rundows(ping 127.0.0.1 >c:\ping.log)

我想把地址和路径该成变量,老是报错。请教大家指点。
$i1 = "127.0.0.1"
$i2 = "c:\ping.log"
发表于 2012-11-8 22:51:12 | 显示全部楼层

#include <Process.au3>

Dim $ip_array[4] = [127, 0, 0, 1]
$file = "c:\ping.log"

$ip = $ip_array[0] & "." & $ip_array[1] & "." & $ip_array[2] & "." & $ip_array[3]
$command = "ping" & Chr(0x20) & $ip & ">" & $file

_RunDOS($command)
 楼主| 发表于 2012-11-8 23:08:31 | 显示全部楼层
真厉害,谢谢veket_linux
发表于 2012-11-8 23:47:56 | 显示全部楼层
本帖最后由 netegg 于 2012-11-8 23:56 编辑

回复 2# veket_linux
这是要干嘛?lz明显是刚入门,整成这样,还没深入学就晕了

[au3]
#include <Process.au3>
_rundos('ping ' & $i1 &  ' > ' & $i2)
[/au3]
发表于 2012-11-8 23:59:05 | 显示全部楼层
仔细琢磨一下单引号和双引号。
发表于 2012-11-9 00:32:12 | 显示全部楼层
回复 1# chasedream

au3自带ping命令~~
 楼主| 发表于 2012-11-9 09:47:14 | 显示全部楼层
回复 6# annybaby

au3 自带的ping命令。返回值是0  没有我想要的
发表于 2013-6-17 11:31:36 | 显示全部楼层
回复  veket_linux
这是要干嘛?lz明显是刚入门,整成这样,还没深入学就晕了
netegg 发表于 2012-11-8 23:47



这个更简洁。
发表于 2013-6-17 11:33:25 | 显示全部楼层
回复  veket_linux
这是要干嘛?lz明显是刚入门,整成这样,还没深入学就晕了
#include <Process.au3>
_rundos('ping ' & $i1 &  ' > ' & $i2)
netegg 发表于 2012-11-8 23:47



这个更简洁。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 08:26 , Processed in 0.075966 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表