Скрипт извлечения комментариев и запись в файл
Option Explicit
On Error Resume Next
Const ForReading = 1
Const ForWriting = 2
Dim scriptFile
Dim commentFile
Dim objScriptFile
Dim objFSO
Dim objCommentFile
Dim strCurrentLine
Dim intIsComment
scriptFile = "C:\test\input.vbs"
commentFile = "C:\test\comments.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objScriptFile = objFSO.OpenTextFile _
(scriptFile, ForReading)
Set objCommentFile = objFSO.OpenTextFile(commentFile, _
ForWriting, True)
Do While objScriptFile.AtEndOfStream <> True
strCurrentLine = objScriptFile.ReadLine
intIsComment = InStr(1,strCurrentLine,"'")
If intIsComment > 0 Then
objCommentFile.Write strCurrentLine & vbCrLf
End If
Loop
WScript.Echo("script complete")
objScriptFile.Close
objCommentFile.Close
Интересное на сайте:
Голосов пока нет

Оставить комментарий