powershell - 使用Powershell脚本以编程方式填写第三方登录屏幕

标签 powershell

我对加快我正在调试的程序的开发/测试工作流程感兴趣。我正在VB6中进行开发,并编写了PS1脚本来相应地移动DLL,但我想更进一步。

我的测试工作流程涉及打开由ThirdPartyLoginScreen.exe启动的具有登录屏幕的程序。有什么方法可以使用PowerShell以编程方式将登录信息传递给此EXE,还是仅限于用VB6编写?

最佳答案

如果您的脚本启动了程序ThirdPartyLoginScreen.exe,并且该程序进入前台,那么一种简便的方法是使用SendKeys

Add-Type -AssemblyName System.Windows.Forms

# start the program
ThirdParytLoginScreen.exe

# send keystrokes to the foreground window
[Windows.Forms.SendKeys]::SendWait('domain\username')
[Windows.Forms.SendKeys]::SendWait('{TAB}')
[Windows.Forms.SendKeys]::SendWait('p@ssw0rd1')
[Windows.Forms.SendKeys]::SendWait('{ENTER}')

这是通过powershell进行基本UI自动化的最简单方法。它具有许多缺点和局限性,但是对于简单的场景,它可能会帮助您畅通无阻。

关于powershell - 使用Powershell脚本以编程方式填写第三方登录屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12824118/

相关文章:

Powershell CSOM 多项选择复选框

powershell - New-AzureRmEventHub 在 PowerShell 中给出错误

iis - PowerShell:检索AppPool中的应用程序数量

与 powershell 等效(或类似)的 Java

powershell - 尝试将 powershell 脚本转换为 VBscript

powershell - 在 PowerShell 中更改第一个输入单词的颜色

multithreading - 访问当前 PowerShell 实例

java - Rijndael 256 加密 : Java and . NET 不匹配

powershell - 如何在 Windows 10 上返回真/假到 Get-WindowsOptionalFeature

c# - 支持自定义 PowerShell cmdlet 的 Get-Help