Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Really appreciate an answer.

The application I am running, requires a user id and password immediately to be input manually. The application is run at dos command prompt. How can i include this in a batch file (ie. the application to be executed, user id and password in a batch file ) without any user intervention, to run.

Ireshad

share|improve this question

You can use VBScript to do that. Use AppActivate to bring the window onto the screen:

Set objShell = CreateObject("WScript.Shell")
objShell.AppActivate "notepad"

Then use SendKeys to send the required keys:

'Wait a second before we do anything
WScript.sleep 1000

intCount=0

'Send the keys to notepad application
Do While intCount <= 10
  wshShell.SendKeys "Line No: " 
  wshShell.SendKeys intCount 
  wshShell.SendKeys "{ENTER}" 

  intCount = intCount + 1
Loop

'Quit
WScript.Quit

Sources:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .