468,720 Members | 1,699 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

Sending a password to another program?

Hello, how can I make a program respond to another program's input request?

For example, this code:

Process.Start("unrar.exe", "e D:\temp\key.rar D:temp2")

will successfully start a program that prompts for a password, and then
submit the password via SendKeys. SendKeys will work with both console and
windows prompts. However, the program only works when is executed by
someone currently logged on in the computer. If you schedule the program to
run when nobody is logged on, the program will fail, I think, because now
window is displayed for the SendKeys function to send the password. This is
the error the program logs when this happen:

System.Security.SecurityException: Unable to create Hook.
at System.Windows.Forms.SendKeys.InstallHook()
at System.Windows.Forms.SendKeys.Send(String keys, Control control,
Boolean wait)
etc, etc,

I also tried with RedirectStandardInput (code below), but this did not work
at all.

Dim p As New Process
p.StartInfo.FileName = "unrar.exe"
p.StartInfo.Arguments = "e D:\temp\key.rar D:\temp2"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardInput = True

This code does not cause an error, but the program replies that an incorrect
password was entered.

Could anyone please help, I need to be able to start a program at boot time.
The program requires a password, but does not provide a command line option
for it.

Any help will be greatly appreciated.

Nov 20 '05 #1
0 1822

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Bonj | last post: by
3 posts views Thread by Ivan Weiss | last post: by
4 posts views Thread by splicemix | last post: by
3 posts views Thread by mfleet1973 | last post: by
5 posts views Thread by =?Utf-8?B?Sm9l?= | last post: by
2 posts views Thread by Allie | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
9 posts views Thread by bryonone | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.