p4t*_*tux 6 powershell curl stream
我只想复制我在Linux系统上执行的相同操作
c:\> \{CURL_EQUIVALENT_ON_WINDOWS} - http://url/script | powershell
Run Code Online (Sandbox Code Playgroud)
那可能吗?
基本上我想执行从服务器下载的流.
IE:步骤:
1)了解如何在PowerShell中执行流.执行一个流(我已在文件系统上拥有)
c:\> type script.ps1 | powershell -command -
Run Code Online (Sandbox Code Playgroud)
但这不起作用.
有一个选项-File来执行"文件",基本上我想尽可能执行流.
2)了解如何执行我从服务器下载并将其传输到PowerShell的流.
感谢dugas我学习了如何使用powershell执行流,并通过此链接http://blog.commandlinekungfu.com/2009/11/episode-70-tangled-web.html我了解如何从http获取内容作为流与powershell.
所以最后的卷曲| powershell管道看起来像这样:
PS C:\>(New-Object System.Net.WebClient).DownloadString("http://url/script.ps1") | powershell -command -
Run Code Online (Sandbox Code Playgroud)
非常感谢为这个问题做出贡献的每个人:-)
您可以使用连字符指定 powershell 的命令参数,以使其从标准输入读取命令。下面是一个例子:
"Write-Host This is a test" | powershell -command -
Run Code Online (Sandbox Code Playgroud)
使用脚本文件内容的示例:
Get-Content .\test.ps1 | powershell -command -
Run Code Online (Sandbox Code Playgroud)
从 powershell 帮助菜单:
powershell /?
Run Code Online (Sandbox Code Playgroud)
-Command
执行指定的命令(和任何参数),就像在 Windows PowerShell 命令提示符下键入这些命令一样,然后退出,除非指定了 NoExit。Command 的值可以是“-”,一个字符串。或脚本块。
If the value of Command is "-", the command text is read from standard
input.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3621 次 |
最近记录: |