그래서이 두 배열을 승인 된 공유 및 현재 공유로 만들었습니다.배열의 파일 비교, 텍스트 파일, 함수, 기록에서 줄 삭제
'Reads Approvedshare txt and makes the txt file into an array
public objFSO
set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objTextFile
Set objTextFile = objFSO.OpenTextFile ("C:\Users\a352592\Desktop\Abdullahi\Remove Shares Utility\approvedshares.txt")
Public strTextFile, strData, arrLines, LineCount
CONST ForReading = 1
strTextFile = ("C:\Users\a352592\Desktop\Abdullahi\Remove Shares Utility\approvedshares.txt")
strData = objFSO.OpenTextFile(strTextFile,ForReading).ReadAll
arrLines = Split(strData,vbCrLf)
LineCount = UBound(arrLines) + 1
wscript.echo "Approved share count : " &Linecount
'Reads current shares txt and also makes that txt into an array
Set objTextFile1 = objFSO.OpenTextFile ("C:\Users\a352592\Desktop\Abdullahi\Remove Shares Utility\currentshares.txt")
Public strTextFile1, strData1, arrLines1, LineCount1
strTextFile1 = ("C:\Users\a352592\Desktop\Abdullahi\Remove Shares Utility\currentshares.txt")
strData1 = objFSO.OpenTextFile(strTextFile1,ForReading).ReadAll
arrLines1 = Split(strData1,vbCrLf)
LineCount1 = UBound(arrLines1) + 1
wscript.echo "current share count : " &Linecount1
나는 다음 두 배열을 가지고 현재의 주에서 배열 항목을 가지고 그 배열을 삭제하고 다시 로그인 할 경우 승인 된 주에 있는지 확인해야합니다. 이것은 두 코드를 비교하기 위해 사용했던 코드이지만 작동하지 않습니다.
/c net.exe share %LINE% /DELETE
이있는 파일
'Compare the two arrays and take out the one's that don't match
For Each ApprovedShareName In arrLines
found = False
For Each CurrentShareName In arrLines1
If ApprovedShareName = CurrentShareName Then
found = True
Exit For
End If
found = False
Next
If found = False Then
'wscript.echo "This isn't on approve shares text : " &textstream2
End If
Next
If arrLines.Contains(CurrentShareName) then
Else
end If
이 내가이 Wscript.shell에 무엇을 포함하고있다
'Set oShell = WScript.CreateObject("WSCript.shell")
'Function oShell (linedelete)
'oShell (linedelete) = oShell.run cmd cd /d C:dir_test\file_test & sanity_check_env.bat arg1
'end Function
txt 파일에서 줄을 삭제하기 위해 사용 된 기능입니다 승인 된 주식
Test
test123
test1234
flexare
this
is
a
example
이것은
Test
test123
added 1
added2
test1234
flexare
added 3
this
is
a
example
added4
나는 현재 주가는 단지 승인 된 주
Test
test123
test1234
flexare
this
is
a
example
제거 아래 배열 파일
다른 txt 파일에 넣어처럼되고 싶어 현재 주에있는 파일입니다
added 1
added2
added 3
added4
내가 네브라스카 많은 txt 파일에 대해이 작업을 수행하기 위해이 작업을 수행해야합니다. 많은 txt 파일을 교환 할 수 있어야합니다. 원하는 결과는 –