1
许多应用程序都关联了通过按F1调用的帮助。
PowerShell命令将启动应用程序并打开帮助?
我想到的应用程序是Powershell ISE,Visual Studio,Microsoft Office等。
有没有标准的机制呢?PS:启动应用程序并打开chm
谢谢。
许多应用程序都关联了通过按F1调用的帮助。
PowerShell命令将启动应用程序并打开帮助?
我想到的应用程序是Powershell ISE,Visual Studio,Microsoft Office等。
有没有标准的机制呢?PS:启动应用程序并打开chm
谢谢。
有没有人命令做,但你可以做到这一点:
方法如下:
启动的应用程序:
Start-Process -FilePath C:\The\Path\To\Program.exe
等待它:
$WindowTitle = "The App You're Waiting For"
while ($true) {
Start-Sleep -Seconds 1
$p = get-process | ? {$_.MainWindowTitle -match $WindowTitle}
if ($p) {break}
}
激活窗口:
[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::AppActivate($WindowTitle)
发送F1键:
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{F1}")
这工作,谢谢。在通过路径“C:\ The Path \ To \ Program.exe”找到它之后,是否可以直接将F1键发送到进程? LoadWithPartialName()中的单引号是故意还是错字? – mcu 2012-02-29 07:21:05
@mcu应该只是2个双引号。您必须激活窗口才能发送F1键。 – 2012-02-29 14:33:20