CMD/BAT - [решено] Выделить всё что между A и B

Аватара пользователя
DJ Mogarych

Re: CMD/BAT - [решено] Выделить всё что между A и B

Сообщение DJ Mogarych »

Powershell из принципа не используете?
Аватара пользователя
megaloman

Re: CMD/BAT - [решено] Выделить всё что между A и B

Сообщение megaloman »

vbs

[spoiler]Код:
[/spoiler]

Код: Выделить всё

FileIn = "D:\Мой контент\Загрузки\History.txt"
Begin = "  Example: "
Endin = " if largest"
'FileIn = "Z:\Box_In\1 текстовый файл.txt"
'Begin = "relatedCount"":"
'Endin = """wasLoaded"":"
FileOut = "Z:\Box_In\2 текстовый файл.txt"
With CreateObject("Scripting.FileSystemObject")
    If Not .FileExists(FileIn) Then
        MsgBox "File: " + vbCrLf + FileIn + vbCrLf + "not exists", 48, "File not exists"
    Else
        With .OpenTextFile(FileIn, 1)
            On Error Resume Next
            AllTxt = .ReadAll
            If Err.Number  0 Then
                MsgBox "File: " + vbCrLf + FName + vbCrLf + Err.Description, 48, "Error Reading File"
                RTrimFile = 2
                .Close
            End If
            On Error GoTo 0
            .Close
        End With
        AllTxt = Replace(" " + AllTxt, Begin, Chr(1))
        AllTxt = Replace(" " + AllTxt, Endin, Chr(1))
        AllTxt = Split(AllTxt, Chr(1))
        With .OpenTextFile(FileOut, 2, True)
            .Write AllTxt(1)
            .Close
        End With
        MsgBox AllTxt(1)
    End If
End With
Ответить

Вернуться в «Скриптовые языки администрирования Windows»