Question

Locked

Using a Batch File to run an application requiring a password

By dcleary ·
Hello

Is it possible to create a Batch File to run an application that contains a password to open the application?

I basicallly need an application to open on a server and continually run. It is a virtual server and when I log out of the session the application closes. So at the moment the only way of having the application running when i want it is to open a session on a PC then leave the PC logged in all night, which is not suitable.

I was thinking of scheduling a task to run on the server everynight to launch the application, however the application requires a username and password to enter.

Is there a way of creating some sort of batch file with this information in so when it is run it opens the application and enters the username and password??

Thank you
D

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

There's a couple of ways

by neilb@uk In reply to Using a Batch File to run ...

It depends on whether the application is a GUI or takes its password from the command line. If it's a command line password then you can pipe input from a file using < - put the username and a cr and the password and a cr into a file called pwd.txt (or whatever suits) and the batch file should read:

runapplication < pwd.txt

If it's still a command line but it's a bit more complicated - or it doesn't seem to work the easy way - find a utility called 'expect'. It is a free UNIX tool but there is a Windows CLI version. Very clever piece of software.

If you have a GUI then you're maybe going to need a script. In vbscript you'd use the shell object Run method to fire off the application and then Appactivate to bring the password window up and then Sendkeys to actually type the password.

Fun, ain't it?

Neil :)

Back to Networks Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums