Following code doesn't work on Command Prompt. It sends only " ". Why? I'm using windows7.
[js]
var shellApp = new ActiveXObject("Wscript.Shell");
shellApp.appActivate("C:\\Windows\\system32\\cmd.exe"); //Other apps seem to work.
WScript.Sleep(1000);
shellApp.sendKeys("%( )");
I want to paste a string. To do that I need to press Alt+Space in command prompt. WSH solution is the best. I can't install and use third party thing because it's not allowed in my enviroment.
Thanks.
Do you want to paste a string or do you want to past the Clipboard contents? To paste the clipboard, you can use this (it is written in VBScript, but you can rebuild it in JavaScript):
Drawback: you need to escape any special character.