Thread: enter key
View Single Post
Old Mar 22nd, 2007, 5:40 PM   #2
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4 mackenga is on a distinguished road
As far as I know you can't do this with a batch file, but you can do it with VBScript or JScript running in WSH (the WIndows Scripting Host). I'm a little pressed for time right now but some snippets that might help are:

Dim objSH

Set objSH = WScript.CreateObject("WScript.Shell")
objSH.SendKeys("{ENTER}")

You need to activate the installer first; that's done with another method of WScript.Shell called ActivateApp or ActivateWindow or something along those lines; you'll find it in any tutorial or documentation on SendKeys since the two go hand in hand.

I know it may seem awkward to learn VBScript or JScript if you don't already know it, but I don't think a batch file is going to solve your problem and either of these is quick enough to pick up. If you've got any JavaScript experience or experience with a C-like language you'll get up and running with JScript pretty quickly.

Just do some searches for introductory material on WSH and SendKeys. That should get you going.

Hope this helps.
__________________
"I'm not a genius. Why do I have to suffer?"
mackenga is offline   Reply With Quote