[英]How can I download and execute a .bat file in a single powershell command?
是否有相當於iwr https://deno.land/install.ps1 -useb | iex
iwr https://deno.land/install.ps1 -useb | iex
用於.bat
文件? 我想從https://yihui.org/tinytex/#installation運行install-bin-windows.bat
而無需手動下載和執行文件。
這是我嘗試將.bat
文件的內容 pipe 到iex
時遇到的錯誤
PS C:\Users\shara> iwr https://tinytex.yihui.org/install-bin-windows.bat -useb | iex
Invoke-Expression:
Line |
1 | iwr https://tinytex.yihui.org/install-bin-windows.bat -useb | iex
| ~~~
| Missing opening '(' after keyword 'for'.
這個答案解釋說,雖然您在技術上可以pipe 將批處理文件的內容直接發送到cmd.exe
,但由此產生的限制大多使這不切實際。
因此,不幸的是,一個強大的解決方案需要將下載的內容保存到臨時批處理文件並執行該文件,如鏈接答案中所示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.