Skip to main content

Batch Script Unary Operators

Unary Operators

The batch script language have unary operators.

The following table lists the available unary operators.

OperatorsDescription
~Tilde operator
!Boolean NOT operator (negation)
-Unary minus operator
note

Tilde (~) is a unary operator used for shortening the long directory names.

For example, C:\> cd C:\Users\ICT\MicrosoftEdgeBackups\backups\MicrosoftEdgeBackup20180303 is same as C:\> cd C:\Users\ICT\Micros~1\backups\Micros~1

The tilde (~) can be used after six consecutive characters to shorten the length and followed by 1.

Table of Contents