Advertisement
Combreal

sendKeyToApp.ps1

May 29th, 2021
1,623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
  2.  
  3. Start-Process -FilePath 'notepad.exe'
  4.  
  5. [Microsoft.VisualBasic.Interaction]::AppActivate("Untitled - Notepad")
  6. Start-Sleep -Seconds 2
  7.  
  8. [System.Windows.Forms.SendKeys]::SendWait("%(fs)")
  9. Start-Sleep -Seconds 2
  10.  
  11. [System.Windows.Forms.SendKeys]::SendWait("%{F4}")
  12. Start-Sleep -Seconds 2
  13.  
  14. [System.Windows.Forms.SendKeys]::SendWait("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement