首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell -我该怎么做?

Powershell -我该怎么做?
EN

Stack Overflow用户
提问于 2014-01-08 17:46:35
回答 1查看 45关注 0票数 0
代码语言:javascript
复制
Get-content -path z:\path\name.txt |
foreach {
        (get-hotfix -Computername $_ |
          Sort-object IUnstalledon)[-1]
}

我想数数并将计数放在输出(get-hotfix )的前面。

代码语言:javascript
复制
1 computer-name update ncncncncn cncncncncncn date time
2 computer name.....
EN

回答 1

Stack Overflow用户

发布于 2014-01-08 18:08:29

也许是这样的?

代码语言:javascript
复制
#Count variable
$i = 0
Get-content -path z:\path\name.txt |
foreach {
        $hotfix = (get-hotfix -Computername $_ | Sort-object IUnstalledon)[-1]

        #Create your output string "Count ComputerName Hotfix"
        Write-Output "$i $_ $hotfix"
        $i++
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21002853

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档