找回密码
 加入
搜索
查看: 2087|回复: 3

[系统综合] 求读取局域网内机器的启动文件夹内容

[复制链接]
发表于 2010-5-14 13:37:05 | 显示全部楼层 |阅读模式
求读取局域网内机器的启动文件夹内容,那位大哥能指出我的脚本错误,或者给个源码.
#include <File.au3>
$sUserName="admin"
$sPassword="Pass123456"

$file = FileOpen("\\172.18.72.170\data$\ip.txt", 0)
If $file = -1 Then
        MsgBox(0, "错误", "不能打开IP文件.")
        Exit
EndIf

While 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop  
$ipadd = StringStripWS($line,8)
;MsgBox(0, "读取的行:", $ipadd)
$mapadd=DriveMapAdd("X:", "\"&$ipadd&"\c$\Documents and Settings\All Users\Start Menu\Programs\Startup", 0, $sUserName, $sPassword)
If $mapadd =1 Then
 $path= "\"&$ipadd&"\c$"
 _FileRecur("X:")
 DriveMapDel("X:")
Else
$mapadd=DriveMapAdd("X:", "\"&$ipadd&"\d$\Documents and Settings\All Users\Start Menu\Programs\Startup", 0, $sUserName, $sPassword)
    If $mapadd=1 Then
        $path= "\"&$ipadd&"\d$"
        _FileRecur("X:") 
                
        Else
                $path= "无法映射"
                    $file2 = FileOpen("\\172.18.72.170\data$\search.txt", 1)

                   If $file2 = -1 Then
                        MsgBox(0, "错误", "不能打开LOG文件.")
                                        Exit
                   EndIf

                        FileWriteLine($file2,$ipadd&Chr(32)&$path)
                        FileClose($file2)
        EndIf
EndIf
Wend

FileClose($file)


    Func _FileRecur($_Path)
        $folder = _FileListToArray($_Path, "*", 1)
        If Not IsArray($folder) Then Return 0
        For $o = 1 To $folder[0]
                $file2 = FileOpen("\\172.18.72.170\data$\search.txt", 1)

                   If $file2 = -1 Then
                        MsgBox(0, "错误", "不能打开LOG文件.")
                                        Exit
                   EndIf

                FileWriteLine($file2,$ipadd&Chr(32)&$path&Chr(32)&$folder[$o])
                FileClose($file2)
                _FileRecur($_Path & "" & $folder[$o])
                Next
                DriveMapDel("X:")
        EndFunc 
 楼主| 发表于 2010-5-14 15:48:10 | 显示全部楼层
怎么就没人呢?高手们都看不见么?....自己先顶下
发表于 2010-5-15 15:06:04 | 显示全部楼层
Documents and Settings\All Users\Start Menu\Programs\Startup
如果为中文系统请用中文:
「开始」菜单\程序\启动
 楼主| 发表于 2010-5-17 10:11:19 | 显示全部楼层
那个路径是没错的,,我们用的是英文系统..关键是循环的问题
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-20 19:56 , Processed in 0.076841 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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