此程序主要是为了实现向局域网内的电脑启动文件夹,复制一个程序。不知道有没有类似多线程去映射然后复制。。这样就可以节约很多时间。高手们,有玩过类似经历告诉一声。$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
|