Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.