首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell脚本的多个输入

Powershell脚本的多个输入
EN

Stack Overflow用户
提问于 2017-09-22 13:51:29
回答 1查看 439关注 0票数 0

我正在运行一个脚本,它要求我输入多个输入,比如"R“"Y”"IP地址“。如何使这个自动化的.How,我可以传递R,然后再R,然后IP地址?我在网上试过很少的例子,但它不起作用.

代码语言:javascript
复制
1) PS C:\orchestrator\scripts> ./Install-Orchestrator.ps1 echo "Y`r" | pw
2)./Install-Orchestrator.ps1 |echo R
3).powershell.exe -noexit -file 'Install-Orchestrator.ps1' "R"

下面是脚本和选项

代码语言:javascript
复制
PS C:\orchestrator\scripts> ./Install-Orchestrator.ps1

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\orchestrator\scripts\Install-Orchestrator.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
---------------------------------

  UiPath Orchestrator v2 Installer

---------------------------------

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\orchestrator\scripts\Test-FrameworkVersion.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
Checking current version of .NET
Current .NET version installed  4.7
You have correct version of .NET: (4.7)

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\orchestrator\scripts\Test-WebDeployVersion.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
Checking current version of Web Deploy
You have correct version of Web Deploy  3.1237.1764

Do you want to test port to database?
[Y] Yes  [N] No  [?] Help (default is "N"): Y
Testing open port to database

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\orchestrator\scripts\Test-PortOpen.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
Enter the host/ip address: 10.10.10.100
Enter the port number to access: 1433
EN

回答 1

Stack Overflow用户

发布于 2022-05-25 19:39:42

尝尝这个

使用下面的输入创建一个文本文件

some_text_file.txt

R

10.0.0.123

然后在Powershell中运行以下命令

代码语言:javascript
复制
Start-Process -FilePath "./Install-Orchestrator.ps1" -ArgumentList "if there are any" -Wait -RedirectStandardInput "./some_text_file.txt"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46366430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档