Patrick,
Here are two quick ways to get a count using DOS commands. If you
never used DOS, use the IDE and click
TOOLS | Visual Studio 200x Command Prompt
This will open a DOS window.
1) Using FIND command:
find /V /C "^M" filename
example:
find /V /C "^M" testargs2.vb
---------- TESTARGS2.VB: 230
FIND takes a wild card, so you can use it for all files in your
project folder for example:
D:\Local\projects\wcChat.NET> find /V /C "^M" *.vb
---------- CLSCHATUSER.VB: 44
---------- COLCHATUSER.VB: 6
---------- FRMCHATMAIN.DESIGNER.VB: 774
---------- FRMCHATMAIN.VB: 991
---------- FRMHELP.DESIGNER.VB: 269
---------- FRMHELP.VB: 9
---------- FRMLOGIN.DESIGNER.VB: 191
---------- FRMLOGIN.VB: 49
---------- MODCHAT.VB: 98
---------- SETTINGS.VB: 11
---------- WCSERVERAPI.VB: 2105
2) Using FOR command in a batch file.
The following batch file will count lineso but the count excludes
blank lines. Cut and paste/save the following into a file called
CountLines.CMD
-------------- CUT HERE -----------------
@echo off
:-----------------------------------------
: count lines in files
:-----------------------------------------
setlocal
if "%1" == "" goto :help
: get list of files
for %%i in (%*) do call :sub_countfile %%i
goto :eof
:-----------------------------------------
:sub_countfile
:-----------------------------------------
: start count the file lines
set a=0
for /f %%i in (%1) do set /A a += 1
: show result and exit call
echo ---------- %1: %a%
goto :eof
:-----------------------------------------
:help
:-----------------------------------------
echo usage: countlines filespec1 [filespec2] ... [filespecN]
goto :eof
-------------- CUT HERE -----------------
example:
countlines testargs2.vb
---------- testargs2.vb: 187
or with a file spec:
D:\Local\projects\wcChat.NET> countlines *.vb
---------- clsChatUser.vb: 38
---------- colChatUser.vb: 4
---------- frmChatMain.Designer.vb: 769
---------- frmChatMain.vb: 869
---------- frmHelp.Designer.vb: 265
---------- frmHelp.vb: 5
---------- frmLogin.Designer.vb: 187
---------- frmLogin.vb: 41
---------- modChat.vb: 71
---------- Settings.vb: 10
---------- wcServerAPI.vb: 1950
You can really do alot these with the extended COMSPEC (DOS) commands
today, especially in manipulating text files, lines and strings. Its
almost a "real" language.