< Back

Out-Hex

Sat Jan 11, 2020 12:35 pm

NAME Out-Hex



SYNOPSIS

Outputs a byte array to stdout in a hex representation.





SYNTAX

Out-Hex [[-InputObject] <Byte[]>] [-Length <Int32>] [-Delimiter <Char>] [<CommonParameters>]





DESCRIPTION

This cmdlet takes a byte array and writes it to the console in line lengths that are easier to read. If the input

array is sent through

the pipeline, it does not need to be "protected" with a ',' to stop it from being unrolled.





PARAMETERS

-InputObject <Byte[]>

The byte array to write to the console in hex.



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Length <Int32>

The maximum number of bytes written to each line. This defaults to 8.



Required? false

Position? named

Default value 8

Accept pipeline input? false

Accept wildcard characters? false



-Delimiter <Char>

The character used to separate each byte representation. This defaults to ' '.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Byte[]





OUTPUTS

None





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 1/19/2018



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$Arr = @(0x01, 0x02, 0x03, 0x04)



$Arr | Out-Hex -Length 2



This writes out:

01 02

03 04



In this case, the array $Arr is unrolled as it is sent to Out-Hex, so it ends up processing 4 separate Length 1

byte arrays.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$Arr = @(0x01, 0x02, 0x03, 0x04, 0x05)



$Arr | Out-Hex -Length 3



This writes out:

01 02 03

04 05



In this case, the array $Arr is not unrolled as it is sent to Out-Hex, so it ends up processing 1 array of length

5.











RELATED LINKS