Powershell和Python的等价物是什么系统标准读取()?

2024-09-29 21:54:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我们在Windows上使用Splunk,在最新版本中,我们现在需要将脚本化警报迁移到定制警报。长话短说,新框架不再使用位置参数,而是使用有效载荷(stdin)。如果使用Python,它很简单,如Spunk documentation

settings = json.loads(sys.stdin.read())

我不知道如何使用Powershell实现同样的功能。cmdlet read host仅从键盘读取stdin。我还发现了使用cmdlet get content从stdin读取的示例,但我只找到了使用现有文件时的示例

Get-Content c:\scripts\test.txt

可能是我需要做一些与this accepted answer中描述的内容相关的事情。在

^{pr2}$

但是我不想发送到另一个进程的stdin,我想阅读另一个进程发送到“我的”进程的Powershell脚本。在


Tags: 版本脚本框架示例read参数进程windows

热门问题