簡體   English   中英

在Powershell上調用可執行文件,然后鍵入命令

[英]invoking an executable on powershell and then type commands

我正在嘗試如下調用可執行文件

.\test_use.exe

然后我按回車鍵得到一個像

"Enter a value between 1 and 5"

我輸入4並獲取一些詳細信息。 有沒有一種方法可以通過Powershell使其自動化。 我試圖通過

.\test_use.exe 4

但這行不通。 我也試過

$input = "4"
Invoke-command ".\test_use.exe" -InputObject $input

我收到以下錯誤

Invoke-command: Parameter cannot be resolved using the specified named characters

有人有指針嗎? 在批處理文件中執行此操作並將輸出存儲在文本文件中會更容易嗎?

批量處理您可以執行以下操作:

(echo 4) | test_use.exe

看到這個問題- 如何在批處理文件中將輸入傳遞給.exe?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM