0

I have a login.exe file. If you run it, it will ask for an user name, and then a password for the username, like this:

  1. ask for username:

    Username: viktor

  2. if you pressed ENTER after the user name, ask for the password:

    viktor@10.10.0.1's password:

I want to create a BATCH file, and when I run this BATCH file, it will open the login.exe and paste the username I use, wait for the next step, and then paste my password. Any idea? Thank you!

foxidrive
  • 40,353
  • 10
  • 53
  • 68
victorio
  • 6,224
  • 24
  • 77
  • 113
  • `sendkeys` in a batch+vbs script or `AutoIt` can help there, if Aacini's suggestion doesn't work with your exe. – foxidrive Nov 25 '13 at 08:45

3 Answers3

3

This depends on the way login.exe read its input. If it follows the standard way, this method should work:

(
echo viktor
echo password
) | login.exe

If this not works, then there is no way to do so...

Aacini
  • 65,180
  • 12
  • 72
  • 108
1

for open your login.exe

start  PATH

example

START C:\Windows\NOTEPAD.EXE

if u want to put in automatic way your username and password i think is not possibile, because you need a comunication between the .exe and .batch file

i suggest to you to write your login.exe in batch. so you cane have all in 1 file, when it works you can compile it in .exe format

Giovanni Far
  • 1,623
  • 6
  • 23
  • 37
1

i'd try

set /p UName=Name?
set /p Pwd=Password? 

start Login.exe %UName% %Pwd%

while it might be neccessary to use call instead of start to get vars Extended

call Login.exe %UName% %Pwd%

or if you don't need the batch really, why not start the login.exe by a shortcut this way?

%SystemRoot%\system32\cmd.exe /k set /p Uname=Name? && set /p PWD=Password? && call login.exe %Uname% %PWD%

and if your login.exe does not take the input with call, you could use this (https://stackoverflow.com/a/10719322/2167103) script for your purpose and call Login.exe instead of the example mycommand.exe in code.

Community
  • 1
  • 1
peet
  • 274
  • 3
  • 5
  • 18