我创建了一个随机密码生成器,我要出文件中的所有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