Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 14th, 2007, 10:03 AM   #1
NightShade01
Programmer
 
Join Date: Oct 2005
Posts: 52
Rep Power: 3 NightShade01 is on a distinguished road
enter key

Hey everyone i'm trying to write an automated install batch file for spybot, so far i have it installing the program updating running and autofixing problems. The issue though is that internet needs to be connected and this isn't the case where i want to use it (work). The three updates though are .exe files but they have no parameters built in. I can use my batch file to launch the update manually but it prompts the user where to install it (all you have to do is hit enter). How do i simulate the pressing of an enter key in my batch file so i don't have any user interaction...thanks
NightShade01 is offline   Reply With Quote
Old Mar 22nd, 2007, 5:40 PM   #2
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 309
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
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware installation guide for Linux beginners coldDeath Coder's Corner Lounge 104 Jul 29th, 2007 4:40 AM
please help me to compile cwl157 C++ 37 Mar 6th, 2006 6:12 PM
replace space with ' * ' TecBrain C++ 15 Apr 13th, 2005 12:32 PM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM
Whats wrong... brandcolt C++ 6 Mar 1st, 2005 10:37 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:47 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC