Skip to content

Instantly share code, notes, and snippets.

@dadooda
Last active June 18, 2022 16:12
Show Gist options
  • Save dadooda/259b625fb7ea0b617e02921f88e26914 to your computer and use it in GitHub Desktop.
Save dadooda/259b625fb7ea0b617e02921f88e26914 to your computer and use it in GitHub Desktop.
Windows show "Run" dialog and populate the command with custom content
# Show the "Run" dialog.
(New-Object -ComObject "Shell.Application").FileRun()
Start-Sleep -Milliseconds 50
# Focus at the dialog.
# Doesn't seem to work, I've got no VisualBasic installed.
#[Microsoft.VisualBasic.Interaction]::AppActivate(“Run”)
# Type in the command.
[System.Windows.Forms.SendKeys]::SendWait("hehe")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment