我的代码到目前为止: 注意它工作率为75%(仅在未安装的.txt中写入1行)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objtext = FSO.OpenTextFile("C:\Jabber Testing\Asset_List.txt")
Do Until objtext.AtEndOfStream
Asset = objtext.ReadLine
InstallPath = "\\" & Asset & "\C$\Program Files (x86)\Cisco Systems\Cisco Jabber\CiscoJabber.exe"
If not FSO.FileExists (InstallPath) Then
outFile="c:\Jabber Testing\Not Installed.txt"
Set objFile = FSO.CreateTextFile(outFile,True)
objFile.Write Asset & vbCrLf
objFile.Close
End If
Loop
objtext.Close
有人可以帮助我,对vbs有中级了解,需要对大约2000台计算机进行排序
答案 0 :(得分:0)
Set objFile = FSO.CreateTextFile(outFile,True)
中的值 True 会导致the file will be overwritten。在 Do Until ... Loop
之前打开输出文件,如下所示:
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objtext = FSO.OpenTextFile("C:\Jabber Testing\Asset_List.txt")
outFile="c:\Jabber Testing\Not Installed.txt"
Set objFile = FSO.CreateTextFile(outFile,True)
Do Until objtext.AtEndOfStream
Asset = objtext.ReadLine
InstallPath = "\\" & Asset & _
"\C$\Program Files (x86)\Cisco Systems\Cisco Jabber\CiscoJabber.exe"
If not FSO.FileExists (InstallPath) Then
objFile.Write Asset & vbCrLf
End If
Loop
objtext.Close
objFile.Close