Tag Archive for 'dos'

Errorlevel and Findstr

ErrorLevel is not %ERRORLEVEL% . This is probably the first one you should read.

Next is the usage of the ERRORLEVEL statement. http://support.microsoft.com/kb/69576

 

The following table shows the effect of statement when writing your batch scriipt.

Statement Algebraic Equivalent.
IF ERRORLEVEL 5 … IF E = 5 OR E > 5 THEN …
IF NOT ERRORLEVEL 6 IF E < 6 THEN …

Here is a sample using findstr and error level. Findstr returns 0 if it successfully finds any occurrence.

findstr -sip Failed log.txt > NULL
IF NOT ERRORLEVEL 1 (
    echo Found.
) else (
    echo Not Found.
)

Pipe your command or an output to the clipboard.

If you ever wanted to copy over a really long multiline dos command or output, what would you usually do?

  1. Copy it line by line (after enabling quick edit mode  of course)
  2. Pipe the output to a text file
  3. … Any other round about way ?

You could just try this little utility called clip.exe, if you haven’t tried it already.

image

XP Command List

I just had to put down this link for future reference.