CheckCAS version 1.0 for Windows

This small application will check one or more Chemical Abstract Service (CAS) Registry Numbers to make sure they are formatted correctly. It validates both the format of the given registry numbers and also their check digits.

Usage

The command-line application takes a CAS number as a single argument, or a series of CAS numbers (one per line) from the standard input (for example piped from a text file or another application, or from the keyboard). Valid CAS numbers are printed to the standard output (for piping to a subsequent application, or redirecting to a text file) and messages are written to the standard error.

Examples

With no arguments the application reads from the standard in. This example takes the contents of the text file inputfile.txt, returning valid CAS numbers in outputfile.txt and recording the invalid CAS numbers in errorlog.txt.

type inputfile.txt | CheckCAS.exe 2> errorlog.txt > outputfile.txt

This example, again with no arguments, reads a single CAS number from the standard in. If the CAS is valid it will write the CAS to the console as confirmation, if it is invalid then an error message will be displayed.

echo 58-08-2 | CheckCAS.exe

This example takes a CAS number as a single argument. If the CAS is valid it will write the CAS to the console as confirmation, if it is invalid then an error message will be displayed.

CheckCAS.exe 58-08-2

The --help argument shows brief usage information and also the version number of the application

CheckCAS.exe --help

 System Requirements

CheckCAS should work on the following Operating systems.

  • Windows 7
  • Windows XP with .NET Framework 2 installed (download from Windows Update)

Download

Download CheckCAS 1.0 for free from here

UPDATE– Four years on I’ve taken this code and converted it to a PowerShell function. This is available Open Source on GitHub here: https://github.com/isjwuk/test-cas