Count the number of lines in a VBScript file

This VBS script will allow you to count very simply the number of lines contained in a file in text format.

In this example I propose to count the number of lines contained in a file called myfile.log . The script will count and display the number of lines in a Windows dialog box.

1) Create a script file, which you call for example comptageligne.vbs and insert the following code:

Change the name of the file myfile.log to suit your needs.

2) Make sure that the script and the file you want to count lines are in the same directory.

3) Run the comptageligne.vbs script by clicking on the .vbs file

Here is my GPS for cycling! The Garmin Edge 830 is a real success with an autonomy of more than 15 hours with the cartography activated and a touch screen that is now absolutely perfect and reacts with the finger and the eye, like a smartphone.

Create a route on Strava or Garmin Connect and it’s immediately transmitted to your GPS. If you’re in a hurry or in an unfamiliar place, the loop generator will simply guide you. If you decide to take another route, the recalculation is automatic and a new route will be proposed.

See my ranking of the best GPS to know more !

  1. Jean-Luc Bir


    Thank you very much for this short and very useful script!
    I was looking for several days on the net.
    Either I found a script that didn’t work or another one that added entries to my text file!

    Your scipt works and moreover leaves the file as is.


Leave a Comment