In Linux, I can start a program in a GNU screen session and then send input to it from outside using screen's stuff
command, which sends characters exactly as if I had typed them in the program. I'm new to developing in Windows and I was wondering if a similar feature exists in Windows?
Asked
Active
Viewed 1,015 times
0

Milad
- 4,901
- 5
- 32
- 43
-
Why did you tag your question with ConEmu? – Maximus Jan 31 '17 at 10:31
-
That's the terminal I'm using which seems to be quite feature rich. I was hoping maybe ConEmu somehow supports this? – Milad Jan 31 '17 at 10:35
-
The standard automation infrastructure in Windows is [UI Automation](https://msdn.microsoft.com/en-us/library/ms747327.aspx). You can check if any given application exposes the required interfaces using the [Inspect](https://msdn.microsoft.com/en-us/library/windows/desktop/dd318521.aspx) tool. – IInspectable Jan 31 '17 at 16:13
-
1http://conemu.github.io/en/GuiMacro.html#Print – Maximus Feb 10 '17 at 00:14
1 Answers
1
If you won't use 3rd party apps like
AutoIT or
AutoHotKey there are
vbscript sendkeys and rather complex
Windows API SendMessage methods.
The here easiest seems to be Converting the Windows Script Host SendKeys Method (to powershell):
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::AppActivate("Test.ps1 - Notepad")
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{F1}")
To evalute the window title for AppActivate
you could use :
Get-Process|Where{$_.Mainwindowtitle}|select processName,Mainwindowtitle