powershell - 将 System.String 转换为对象
问题描述
我正在使用 PowerShell 查询 Cisco 交换机的接口状态,该状态以System.String
. 我想将此字符串转换为一个对象,但不知道如何去做。如果有办法按列宽分解字符串,回车是我能想到的唯一方法,但我不知道如何编码。
字符串如下所示:
端口名称 状态 Vlan 双工速度类型 Gi1/0/1 Port-Channel 1 connected trunk a-full a-1000 1000BaseLX SFP Gi1/0/2 Port-Channel 1 connected trunk a-full a-1000 1000BaseLX SFP Gi1/0/3 端口通道 28 连接路由 a-full a-1000 1000BaseLX SFP Gi1/0/4 端口通道 28 连接路由 a-full a-1000 1000BaseLX SFP
解决方案
推荐阅读
- javascript - 将活动类添加到 html 元素不起作用
- reactjs - 如何让 event.preventDefault() 在 React 中工作
- file - $(file < $@) 扩展为空,但不应该
- ansible - 无法将纪元转换为ansible中的可读格式
- extendscript - 循环完成比文件对象读/写/导入快
- windows - 在 Windows KVM 实例中运行 Win10 Docker 容器时出错
- django - 'django.contrib.messages.context_processors.messages' 必须在 DjangoTemplates 中启用
- oracle - TEXT #ORACLE 中的新行
- python - 是否有用于非标准代数类对象的稀疏矩阵运算的 python 库?
- sql - 2个数据集之间的项目结束总数