curl http://url/script.ps1 | powershell可能吗?

前端之家收集整理的这篇文章主要介绍了curl http://url/script.ps1 | powershell可能吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我只想复制我在 Linux系统上执行的相同操作 @H_403_2@c:\> \{CURL_EQUIVALENT_ON_WINDOWS} - http://url/script | powershell

那可能吗?

基本上我想执行从服务器下载的流.

IE:步骤:

1)了解如何在PowerShell中执行流.
执行一个流(我已在文件系统上拥有)

@H_403_2@c:\> type script.ps1 | powershell -command -

但这不起作用.

有一个选项-File来执行“文件”,基本上我想尽可能执行流.

2)了解如何执行我从服务器下载并将其传输到PowerShell的流.

解决方法

您可以使用连字符指定powershell的命令参数,以使其从标准输入读取其命令.以下是一个例子: @H_403_2@"Write-Host This is a test" | powershell -command -

使用脚本文件内容的示例:

@H_403_2@Get-Content .\test.ps1 | powershell -command -

从powershell帮助菜单

@H_403_2@powershell /?

-Command
Executes the specified commands (and any parameters) as though they were
typed at the Windows PowerShell command prompt,and then exits,unless
NoExit is specified. The value of Command can be “-“,a string. or a
script block.

@H_403_2@If the value of Command is "-",the command text is read from standard input.
原文链接:https://www.f2er.com/linux/393130.html

猜你在找的Linux相关文章