|
C:\GuardPost>ntlib :File_Number_Lines Redir_Demo.cmd
^ =========================================================================
/!\ ntlib.cmd 2002.10.18 Advanced NT/2K/XP Command Library (Freeware)
/lib\=========================================================================
Numbering C:\GuardPost\Redir_Demo.cmd...
_FNL=Redir_Demo.cmd.numbered.txt
C:\GuardPost>TYPE
%_FNL%
01. @ECHO OFF
02.
03. :* Create a zero length file to use for the demo
04. %.ZeroFile% FileName.Ext
05.
06. IF EXIST FileName.Ext
%.Silent% (
07. (ECHO: {Silent} Normal
Message 1)
08. (%.ErrEcho% {Silent} Error Message 1)
09. )
10.
11. IF EXIST FileName.Ext
%.Quiet% (
12. (ECHO: {Quiet} Normal
Message 2)
13. (%.ErrEcho% {Quiet} Error Message 2)
14. )
15.
16. IF EXIST FileName.Ext
%.Kity% (
17. (ECHO: {Kity} Normal
Message 3)
18. (%.ErrEcho% {Kity} Error Message 3)
19. )
20.
21. IF EXIST FileName.Ext
%.Show% (
22. (ECHO: {Show} Normal
Message 4)
23. (%.ErrEcho% {Show} Error Message 4)
24. )
25.
26. IF EXIST FileName.Ext
%.ShowErr% (
27. (ECHO: {ShowErr} Normal
Message 5)
28. (%.ErrEcho% {ShowErr} Error Message 5)
29. )
30.
31. IF EXIST FileName.Ext
%.ShowAll% (
32. (ECHO: {ShowAll} Normal
Message 6)
33. (%.ErrEcho% {ShowAll} Error Message 6)
34. )
35.
36. :* Delete the demo file
37. DEL FileName.Ext
[Redir_Demo.cmd in Normal Mode - No Redirection]
C:\GuardPost>Redir_Demo
{Quiet} Error Message 2
{Kity} Normal Message 3
{Show} Normal Message 4
{Show} Error Message 4
{ShowErr} Normal Message 5
{ShowErr} Error Message 5
{ShowAll} Normal Message 6
{ShowAll} Error Message 6
[Redir_Demo.cmd in Quiet Mode - Direct STDOUT to NUL]
C:\GuardPost>Redir_Demo >NUL
{Quiet} Error Message 2
{Show} Normal Message 4
{Show} Error Message 4
{ShowErr} Error Message 5
{ShowAll} Normal Message 6
{ShowAll} Error Message 6
[Redir_Demo.cmd in Silent Mode - Direct STDOUT and STDERR to NUL]
C:\GuardPost>Redir_Demo >NUL 2>&1
{Show} Normal Message 4
{ShowErr} Error Message 5
{ShowAll} Normal Message 6
{ShowAll} Error Message 6
[Redir_Demo.cmd in Logging Mode - Direct STDOUT and STDERR to logfile.txt]
C:\GuardPost>Redir_Demo >logfile.txt 2>&1
{Show} Normal Message 4
{ShowErr} Error Message 5
{ShowAll} Normal Message 6
{ShowAll} Error Message 6
C:\GuardPost>TYPE
logfile.txt
{Quiet} Error Message 2
{Kity} Normal Message 3
{Show} Error Message 4
{ShowErr} Normal Message 5
.ZeroFile - Creates a zero-byte file or "zeroes out" an existing file
KITY=Keep It To Yourself
(tell me the good news, suppress any errors)
File_Number_Lines can also be invoked using it's short name:
ntlib :FNL FileToNumber
The name of the output file will be returned in the variable %_FNL%.
|