找回密码
 加入
搜索
查看: 2042|回复: 2

[效率算法] 向局域网电脑启动文件夹写入文件

[复制链接]
发表于 2010-11-23 13:43:35 | 显示全部楼层 |阅读模式
此程序主要是为了实现向局域网内的电脑启动文件夹,复制一个程序。不知道有没有类似多线程去映射然后复制。。这样就可以节约很多时间。高手们,有玩过类似经历告诉一声。
$sUserName = "fa1"
$sPassword = "Coe123"

$file = FileOpen("C:\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("Z:", "\" & $ipadd & "\c$\Documents and Settings\All Users\Start Menu\Programs\Startup", 0, $sUserName, $sPassword)
        If $mapadd = 1 Then
                $path = "\" & $ipadd & "\c$"
                fcp()
        Else
                $mapadd = DriveMapAdd("Z:", "\" & $ipadd & "\d$\Documents and Settings\All Users\Start Menu\Programs\Startup", 0, $sUserName, $sPassword)
                If $mapadd = 1 Then
                        $path = "\" & $ipadd & "\d$"
                        fcp()
                Else
                        $path = "无法映射"
                        fcp()
                EndIf
        EndIf

WEnd

FileClose($file)


Func fcp()

        If FileCopy("\\server\data$\softlist.exe", "Z:", 1) Then
                $cpcheck = "成功"
        Else
                $cpcheck = "失败"
        EndIf

        $file2 = FileOpen("\\server\data$\test.txt", 1)

        If $file2 = -1 Then
                MsgBox(0, "错误", "不能打开LOG文件.")
                Exit
        EndIf
        If $ipadd <> "" Then
                FileWriteLine($file2, $ipadd & " | " & $path & " | " & $cpcheck)
        EndIf
        FileClose($file2)
        DriveMapDel("Z:")
EndFunc   ;==>fcp
发表于 2010-11-23 14:19:56 | 显示全部楼层
不错啊,为什么要复制呢?
为什么不考虑让每个机器都来下载程序到本机呢?
 楼主| 发表于 2010-11-23 16:23:16 | 显示全部楼层
回复 2# nxbigdaddy
那样的话,那还是要每台机器装有下载功能的客户端啊。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-16 02:52 , Processed in 0.073663 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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