Skip to content

ConvertTo AnsiSequence

viscalyxbot edited this page Aug 25, 2024 · 1 revision

ConvertTo-AnsiSequence

SYNOPSIS

Converts a string value to an ANSI escape sequence.

SYNTAX

ConvertTo-AnsiSequence [-Value] <String> [<CommonParameters>]

DESCRIPTION

The ConvertTo-AnsiSequence command converts a string value to an ANSI escape sequence. It is used to format text with ANSI escape codes for color and formatting in console output.

EXAMPLES

EXAMPLE 1

ConvertTo-AnsiSequence -Value "31"

This example converts the string value "31" to its ANSI escape sequence.

PARAMETERS

-Value

The string value to be converted to an ANSI escape sequence.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

OUTPUTS

System.String

NOTES

This function supports ANSI escape codes for color and formatting. It checks if the input string matches the pattern of an ANSI escape sequence and converts it accordingly. If the input string does not match the pattern, it is returned as is.

RELATED LINKS

Clone this wiki locally