Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.


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


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

  intCount = intCount + 1



share|improve this answer

Your Answer


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.