## Running CodeScanner from the Command-line

CodeScanner can be run from a command prompt using the command, codescanner, and appropriate parameters and options. The output is in the form of HTML or XML files.

When CodeScanner is invoked from the command line it can scan files within any Symbian OS project directory structure or within a single source file.

The options are:

Option | Description
--- | ---
-c <config file> | Specify a config file used by CodeScanner.
-h | Display CodeScanner help.
-i <src dir|file> | Specify additional directory or file to scan. For example: codescanner -i c:/myproject/includes c:/myproject/sources c:/myproject/results
-l <path|file> | Creates debug log file of the specified filename in the same directory as the CodeScanner command-line tool. Include a path to specify another location to store the log file.
-o html|xml|std | Specifies the output report format. Multiple formats can be set at the same time. Default setting is html. For example: codescanner -o xml,html c:\sources c:\reports
outputdir | The directory in which to produce the output HTML files. If omitted from the command-line, CodeScanner will only output the problems list and not generate a report.
-r | Used to specify the LXR version.
sourcedir | The directory containing the source code.
sourcefile | The single source file to scan, and its path.
-t on|off | Creates a time-stamped directory for results. Default setting is on. For example: codescanner -t off c:/myproject/sources c:/myproject/results
-v | Display verbose messages.
-x | Used to specify the LXR site. Once scanning is complete, links in the report will point to the LXR server instead of the local directory (C:\sources). For example: codescanner -x http://some.lxr.server/sources/ -r S60_3_2_12 c:\sources c:\reports

#### Running CodeScanner on a directory

- At the command prompt for your CodeScanner directory enter:

  codescanner [options] <sourcedir> <outputdir>

For example:

codescanner -t C:\Projects\CodeToScan C:\Output

This example scans all of the text code files found in C:\Projects\CodeToScan and saves the HTML output to C:\Output. No extra lines are displayed in the output to provide context for the line containing each issue.

#### Running CodeScanner on a single source file

- At the command prompt for your CodeScanner directory enter:

  codescanner [options] <sourcefilewithpath> <outputdir>

For example:

codescanner c:\Projects\SingleFiles\Csymbianfile.cpp c:\tmp

This example scans the single file, Csymbianfile.cpp, and saves the HTML output to C:\tmp.

Related references

- Running CodeScanner