PowerTip of the Day-Adding Extra Information
原文地址:http://app.en25.com/e/es.aspx?s=1403&e=4479&elq=5c2d3cdc5fc74ac49db66a5047abbcca
原文:
Sometimes you may want to tag results returned by a cmdlet with some extra information, such as a reference to some PC name or a timestamp. You can use Add-Member to tag a note property to the result.
This line gets all services and adds two new columns: the PC name, and the date and time the results were returned:
$result = Get-Service | Add-Member NoteProperty Computer $env:computername -pass | Add-Member NoteProperty Timestamp (Get-Date) -pass
$result | Select-Object Status, Name, Computer, Time*
Note that you will only see the new columns if you explicitly ask Select-Object to show them.
翻译:
有时需要在cmdlet命令的返回结果中加一些附加的信息,比如机器名或者时间戳。可以在返回的结果中使用Add-Member来标记一个笔记属性。
下面的命令返回所有的服务并且加了附加的两个列:机器名和时间戳:
$result = Get-Service | Add-Member NoteProperty Computer $env:computername -pass | Add-Member NoteProperty Timestamp (Get-Date) -pass
$result | Select-Object Status, Name, Computer, Time*
如果只想显示这两个新增列的话只要通过Select-Object明确指定就可以了。
笔记:
Add-Member NoteProperty 列名 值 -pass
---------------------------------------------------------------
aspnetx的BI笔记系列索引:
使用SQL Server Analysis Services数据挖掘的关联规则实现商品推荐功能
---------------------------------------------------------------
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 理解Rust引用及其生命周期标识(下)
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 2025成都.NET开发者Connect圆满结束
· 后端思维之高并发处理方案
· 千万级大表的优化技巧
· 在 VS Code 中,一键安装 MCP Server!
· 10年+ .NET Coder 心语 ── 继承的思维:从思维模式到架构设计的深度解析
2007-06-17 盖茨来华演讲视频下载地址
2007-06-17 Microsoft acquires DUNDAS technology for SQL SERVER 2008