• 小技巧:统计文本文件行数


    1. 第三种方法更简便:首先也是新建一个TXT文件,然后将下面代码复制进去。

      <job id="HowManyLines">

      <script language="VBScript">

      Const ForReading = 1

      Dim strMsg, fileNames, objFile, lineCount(100)

      set objFSO = CreateObject("Scripting.FileSystemObject")

      set WshShell = WScript.CreateObject("WScript.Shell")

      strMsg = InputBox("Please enter your file name:")

      fileNames = Split(strMsg, " ", -1, 1)

      For i = 0 To UBound(fileNames)

      Set objFile = objFSO.OpenTextFile(fileNames(i) & ".txt", ForReading)

      Do While objFile.AtEndOfStream <> True

      objFile.ReadLine

      lineCount(i) =lineCount(i) + 1

      Loop

      objFile.Close

      Next

      strMsg = ""

      For i = 0 To UBound(fileNames)

      strMsg = strMsg & lineCount(i)& " "

      Next

      MsgBox(strMsg)

      </script>

      </job>

    2. 保存,并和上面两种方法一样,将这个新建的TXT文本的后序格式名改为wsf

    3. 双击打开,输入你要查找的TXT文本名字

    4. 结果就出来了。

  • 相关阅读:
    open jdk
    llvm 编译
    llvm Array Bounds Check Elimination
    tmux 共享窗口大小
    llvm pass
    llvm code call graph
    llvm -O 经历过那些pass
    tcmalloc asan
    web ide
    eclipse配置
  • 原文地址:https://www.cnblogs.com/xuxiaoshuan/p/3651336.html
Copyright © 2020-2023  润新知