Send-Keys
SYNOPSISโ
Send a sequence of keys to one or more application windows.
SYNTAXโ
Send-Keys [[-WindowTitle] <String>] [-GetAllWindowTitles] [[-WindowHandle] <IntPtr>] [[-Keys] <String>]
[[-WaitSeconds] <Int32>] [<CommonParameters>]
DESCRIPTIONโ
Send a sequence of keys to one or more application window. If window title searched for returns more than one window, then all of them will receive the sent keys.
Function does not work in SYSTEM context unless launched with "psexec.exe -s -i" to run it as an interactive process under the SYSTEM account.
EXAMPLESโ
EXAMPLE 1โ
Send-Keys -WindowTitle 'foobar - Notepad' -Key 'Hello world'
Send the sequence of keys "Hello world" to the application titled "foobar - Notepad".
EXAMPLE 2โ
Send-Keys -WindowTitle 'foobar - Notepad' -Key 'Hello world' -WaitSeconds 5
Send the sequence of keys "Hello world" to the application titled "foobar - Notepad" and wait 5 seconds.
EXAMPLE 3โ
Send-Keys -WindowHandle ([IntPtr]17368294) -Key 'Hello world'
Send the sequence of keys "Hello world" to the application with a Window Handle of '17368294'.
PARAMETERSโ
-WindowTitleโ
The title of the application window to search for using regex matching.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-GetAllWindowTitlesโ
Get titles for all open windows on the system.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WindowHandleโ
Send keys to a specific window where the Window Handle is already known.
Type: IntPtr
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Keysโ
The sequence of keys to send. Info on Key input at: http://msdn.microsoft.com/en-us/library/System.Windows.Forms.SendKeys(v=vs.100).aspx
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WaitSecondsโ
An optional number of seconds to wait after the sending of the keys.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
CommonParametersโ
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTSโ
Noneโ
You cannot pipe objects to this function.โ
OUTPUTSโ
Noneโ
This function does not return any objects.โ
NOTESโ
RELATED LINKSโ
[http://msdn.microsoft.com/en-us/library/System.Windows.Forms.SendKeys(v=vs.100).aspx]