Skip to content

Instantly share code, notes, and snippets.

@ishu3101
Created January 30, 2016 01:53
Show Gist options
  • Save ishu3101/df7967217c250f02d17e to your computer and use it in GitHub Desktop.
Save ishu3101/df7967217c250f02d17e to your computer and use it in GitHub Desktop.
SendKeys Command To PowerShell
var o = new ActiveXObject("WScript.Shell");
//Force x86 Version
o.Run("C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe -windowstyle hidden");
WScript.Sleep(5000);
o.AppActivate("powershell");
o.SendKeys("Get-Process > output.txt {Enter}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment