如何在Powershell中输出多个哈希表 [英] How to output multiple hash tables in Powershell

查看:52
本文介绍了如何在Powershell中输出多个哈希表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个键/值对哈希表的哈希表(来自 .ini 文件).它看起来像这样:

I have a hashtable of hashtables of key/value pairs (from a .ini file). It looks like this:

Name                           Value                                                                   
----                           -----                                                                   
global                         {}                                                                      
Variables                      {event_log, software_repo}                                               
Copy Files                     {files.mssql.source, files.utils.source, files.utils.destination, fil...

如何在一个哈希表中输出所有键/值对,而不是这样做?

How can I output all of the key/value pairs in one hash table, instead of doing this?

$ini.global; $ini.variables; $ini."Copy Files"

推荐答案

鉴于 $hh 是您可以使用循环的哈希表的哈希表:

Given that $hh is you hashtable of hashtables you can use a loop :

foreach ($key in $hh.keys)
{
  Write-Host $hh[$key]
}

这篇关于如何在Powershell中输出多个哈希表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆