gpt4 book ai didi

powershell - Powershell哈希表

转载 作者:行者123 更新时间:2023-12-03 01:19:04 25 4
gpt4 key购买 nike

我正在尝试使用以下代码创建自定义哈希表,但未获得任何输出

foreach ($user in $users){
$files = Get-ChildItem -Recurse "\\192.168.1.2\c$\user\$user"
$totalsize = ($files | Measure-Object -Sum Length).sum / 1mb
$totalsize = [decimal]::round($totalsize)

$output=@{"User"="$user" ; "Size" = "$totalsize"}

最佳答案

这样效果更好吗?

$Output = 
foreach ($user in $users){
$files = Get-ChildItem -Recurse "\\192.168.1.2\c$\user\$user"
$totalsize = ($files | Measure-Object -Sum Length).sum / 1mb
$totalsize = [decimal]::round($totalsize)
@{"User"="$user" ; "Size" = "$totalsize"}
}

$output

关于powershell - Powershell哈希表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20204199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com