第三种方法更简便:首先也是新建一个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>
保存,并和上面两种方法一样,将这个新建的TXT文本的后序格式名改为wsf
双击打开,输入你要查找的TXT文本名字
结果就出来了。
小技巧:统计文本文件行数
免责声明:文章转载自《小技巧:统计文本文件行数》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
上篇linux安装ActiveMQ详细介绍MySQL/MariaDB的锁下篇
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=