powershell - 检查哈希表是否包含值

标签 powershell process hashtable

我使用 PowerShell 执行 SQL 查询以获取计算机进程 ID 并返回以下哈希表:

$processId
5068
6176
7240
7632

现在,我使用:$processId -contains 5068检查此值是否存在于 $processId或不。

我的预期是 true但它返回 false .

我不知道为什么。欢迎大家解答。

结果 $processId |获取成员(member):

最佳答案

在哈希表上,您可以使用 ContainsKey() 检查现有项目。方法。例如:

$processId.ContainsKey(5068)

关于powershell - 检查哈希表是否包含值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49730510/

相关文章:

python-2.7 - python 2.7 模块 pandas 未安装 "cannot import name hashtable"

c - 进程运行不正确

powershell - 如何强制数组类型?

sql - Powershell SQLCMD

PowerShell,针对不指向文件但启动文件下载的 url 调用 WebRequest

python - 获取当前打开文件的完整路径

Android进程 killer

c++ - 搜索字符串的最快方法

java - 使用链式对象实现 HashTable

excel - Ping 脚本不导出结果