0
试图找到我的文件中的数字可以被3整除。我怎样才能让我的foreach循环分别读取每个数字?我试图弄清楚如何将文件放入数组中,能帮助我吗?Powershell - 如何将我的.dat文件放入数组中?
这是我的文件:
6 9 7
-----
5 2 9
3 4 4
1 6 9
这是到目前为止我的代码:
function number{
param($b)
# Loop through all lines of input
foreach($a in $b){
if ($line = % 3)
{
Write-Output "divisible by 3"
}
else {
Write-Output "number not divisible by 3"
}
}
}
#Variables
#Get input from csv file
$a = Import-Csv "document 2.Dat"