Tests a file for a “magic number” (identifying sequence of bytes) at a given location.
Test-MagicNumber.ps1 [-Bytes] <Byte[]> [[-Path] <String>] [-Offset <Int32>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Test-MagicNumber.ps1 0xEF,0xBB,0xBF README.md
True if a utf-8 signature (or “BOM”, byte-order-mark) is found.
Test-MagicNumber.ps1 0x0D,0x0A README.md -Offset -2
True if README.md ends with a Windows line-ending.
Test-MagicNumber.ps1 0x50,0x4B download123543
True if download123543 starts with a PK ZIP magic number (“PK”), and is therefore likely ZIP data.
A list of byte values to compare against those read from the file.
Type: Byte[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A file to look for the bytes in.
Type: String
Parameter Sets: (All)
Aliases: FullName
Required: False
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
The number bytes into the file to begin reading the bytes to compare. Use a negative number to count from the end of the file.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.