小编use*_*192的帖子

在VBScript中每次附加到文件而不是覆盖文件

我只是想在这里制作一个日志文件.我尝试用OpenTextFile而不是做某事CreateTextFile,但之后它什么都没写,我真的不确定为什么,而且我找不到我需要的信息.

'Nick Repella 10/29/13

'Needed in case object does not exist (outdated list)
On Error Resume Next

Function IsCompDisabled(strLine)
    Dim objComputer
    objComputer = "LDAP://cn="
    objComputer = objComputer & strLine
    objComputer = objComputer & ",ou=HIDDENOU,dc=HIDDENDC,dc=HIDDENDC,dc=HIDDENDC"
    IsCompDisabled = GetObject(objComputer).AccountDisabled
End Function 

'Set the file to read computer names from (Change C:\scripts\text.txt to the 
'target file)
Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\scripts\text.txt", 1)

Dim strLine

Do While Not objFileToRead.AtEndOfStream
    strLine = objFileToRead.ReadLine()
    If (IsCompDisabled(strLine) = True) Then
        outFile="c:\scripts\compDisableCheck.log"
        Set objFSO = …
Run Code Online (Sandbox Code Playgroud)

vbscript file append overwrite

1
推荐指数
1
解决办法
3万
查看次数

标签 统计

append ×1

file ×1

overwrite ×1

vbscript ×1