I'm having trouble figuring out how to respond to a system prompt in a console application.
I need to run a setup.exe on users PCs under the admin context.
If I do something like:
system("runas /user:computername\administrator setup.exe");
the system then prompts me with:
"enter password for administrator"
I thought I could send the password to the keyboard buffer, but the problem is that the console app stops processing until a response is typed at the command prompt.
I'm not sure how to get around this. I used to use su, which allows you to supply a password as a parameter but microsoft has taken this functionality away with runas.
Any help appreciated.