我創建了一個隨機密碼生成器,我要出文件中的所有10個輸出到一個txt文件我不能「出文件」我的整個循環只有一行
但是我現在只有1行輸出。
for ($i=1; $i -le 10; $i++){
$caps = [char[]] "ABCDEFGHJKMNPQRSTUVWXY"
$lows = [char[]] "abcdefghjkmnpqrstuvwxy"
$nums = [char[]] "2346789"
$spl = [char[]] "[email protected]#$%^&*?+"
$first = $lows | Get-Random -count 1;
$second = $caps | Get-Random -count 1;
$third = $nums | Get-Random -count 1;
$forth = $lows | Get-Random -count 1;
$fifth = $spl | Get-Random -count 1;
$sixth = $caps | Get-Random -count 1;
$pwd = [string](@($first) + @($second) + @($third) + @($forth) + @($fifth) + @($sixth))
Write-Host $pwd
Out-File .\Documents\L8_userpasswords.txt -InputObject $pwd
}
當我打開的.txt我只看到1線的輸出的,而不是10