---
title: Command line examples
slug: command-line-examples
docTags: 
createdAt: 2023-03-08T03:30:37.000Z
---

## Basic barcode reading from a file

Read `code39` barcode.   Output is the default JSON format:

:::BlockQuote
BarcodeReaderCLI <font color="#eb144c">-type=code39</font> "*your\_file.tif*"
:::

Read `code39` barcode.  Output just text value to the console:

:::BlockQuote
BarcodeReaderCLI -type=code39 "*your\_file.tif*" <font color="#eb144c">-format=text --output-text="&#x7B;text\}"</font>
:::

## Read barcodes from Web-based images using URL

Read barcodes from Web-based images. Read from multiple images with a single call, each reading a different barcode type.&#x20;

:::BlockQuote
BarcodeReaderCLI <font color="#eb144c">-type=</font><font color="#eb144c">pdf417 </font>"https\://*your\_site*/*your\_file.jpg*" <font color="#eb144c">-type=</font><font color="#eb144c">code39</font>  "https\://your\_side/*your\_file.pdf*"
:::

## Specify options and sources in a configuration file

:::BlockQuote
BarcodeReaderCLI  <font color="#eb144c">\@"*brcli-example.config*"</font>
:::

## Read Driver's License barcodes

:::BlockQuote
BarcodeReaderCLI <font color="#eb144c">-type=drvlic</font> "*your\_file.pdf*"
:::

## Read barcodes from multiple files in a folder

Read barcodes in a folder and sub-folders.  Limit file types to BMP and PDF

:::BlockQuote
BarcodeReaderCLI -type=pdf417 <font color="#eb144c">-sub -incl="*\*.bmp \*.pdf*" "*your\_folder*"</font>
:::

## Read barcodes using Targeted Barcode Reader (TBR)

Read using TBR Code 120

:::BlockQuote
BarcodeReaderCLI <font color="#eb144c">-type=datamatrix</font> <font color="#eb144c">-tbr=120</font>  "*your\_file.bmp*"
:::

## Read non-English barcode text values&#x20;

Processing is configured in <font color="#eb144c">`encoding.config`</font> file.   Features in this example

- Read multiple barcode types set in <font color="#eb144c">`-type=`</font> option.
- Output results to multiple files with <font color="#eb144c">`output=`</font> options (JSON, CSV, and TEXT files)
- Output to text files using the<font color="#eb144c">`template.txt`</font> file, configure with <font color="#eb144c">`-output-text=`</font> option.
- Limit type date in the output with <font color="#eb144c">`-fields=`</font> option
- Define macros with <font color="#eb144c">`-d=` </font>option and expanding
- Use <font color="#eb144c">`-encoding=`</font> option to convert barcode values to localized text

:::BlockQuote
BarcodeReaderCLI <font color="#eb144c">\@"*encoding.config*"</font> -output=console
:::

:::CodeblockTabs
encoding.config

```linux
# ============   OPTIONS
-type=pdf417,qr,datamatrix 

# ============   INPUT
-d="SRCDIR=images/encoding/"
-d="OUTDIR={path.tmp}/brcli/"

"{SRCDIR}QR.UTF8.japanese.プライバシーマーク.png"

# ===========    Read language-encoded barcodes
#                USE 'encoding' to get UTF8 text
-encoding=CP1256
"{SRCDIR}DM.CP1256.arabic.بساطة لأنه الأل.tif" 

-encoding=BIG5
"{SRCDIR}PDF417.big5.Chinese.包含一杯准饮料.bmp" 

-encoding=CP1251
"{SRCDIR}PDF417.cp1251.russian.ЙшзщЪфг.bmp" 

# ============== Read UTF8-encoded barcodes in various languages
-encoding=	# Disable encoding
"{SRCDIR}PDF417.UTF8.pdf"

# ============   OUPUT
# Select fields in output files
-fields=text,type,path,encoding 

# Set output files
-output="{OUTDIR}utf8.json" 
-output="{OUTDIR}utf8.csv"

# Set format for TEXT output
-output-text="./template.txt"
-output="{OUTDIR}utf8.txt"
```

template.txt

```none
[onSession]{tab}SESSION:  application: {app.filename}{tab} {app.version}
{tab} date/time: {start.date} {start.time}
[onSource]{tab|#x2}SOURCE:  type: {type}  path: {path}
{tab|#x2} files: {files}  bc.count: {bc.count}
[onFile]{tab|#x3}FILE path: {path}
{tab|#x3} pages: {pages}  format: {format}  size: {size}  bc.count: {bc.count}
[onPage]{tab|#x4}PAGE:path: {path}  page: {page}
{tab|#x4} width: {width}  height: {height}  bpp: {bpp}  hdpi: {hdpi}  vdpi: {vdpi}
{tab|#x4} compr: {compr}  bc.count: {bc.count}
[onBarcode]{tab|#x5}BARCODE:  type: {type}  length: {length}  
{tab|#x5} rectangle: {rectangle.left}:{rectangle.top}-{rectangle.right}:{rectangle.bottom}
{tab|#x5} rotation: {rotation}  path: {path}  page: {page}
{tab|#x5} skew: {skew}  mode: {mod}  charset: {charset}
{tab|#x5} text: {text}
{tab|#x5} data: {data}
[onDrvLic]{tab|#x6} DRIVER LICENSE:
{tab|#x6} NAME: {last}   {middle}   {first}
{tab|#x6} DATA: {dob}  EYES: {eyes} HAIR: {hair}  SEX: {sex} HEIGHT: {height} WEIGHT: {weight} 
{tab|#x6} ADDRESS: {street}  {city}  {state}  {postal}
{tab|#x6} LICENSE: {id}  ISSUED: {issued}  EXPIRES: {expires}
```
:::

