スクリプト例
左0埋め9桁の2進数を0から111111111まで順番に表示するスクリプトです。
<#
.SYNOPSIS
左0パディングの9桁2進数序列の文字列を生成します。
#>
for($cnt=0; $cnt-lt 512; $cnt++){
#二進数へ変換
$tmp = [Convert]::ToString($cnt, 2)
#左0パディング
$padding = "000000000"
$tmp = $padding + $tmp
$tmp = $tmp.substring($tmp.length - $padding.length, $padding.length)
<#
$tmp = $tmp.replace("1","1`t") #一桁ごとタブセパレートしたかったので…
$tmp = $tmp.replace("0","0`t")
#>
Write-Output $tmp
}
実行するとこんな感じのデータができます。
000000000
000000001
000000010
000000011
000000100
000000101
000000110
000000111
:
:
111111111