2 Replies - 4509 Views - Last Post: 18 October 2012 - 12:36 PM Rate Topic: -----

#1 lukasz_ltt   User is offline

  • New D.I.C Head

Reputation: 18
  • View blog
  • Posts: 29
  • Joined: 12-October 12

Is it possible to automatic response for command prompt in console?

Posted 16 October 2012 - 07:02 PM

Situation looks like this:
1. application executes program (git.exe) via console
2. that program asks user to type in password
3. application send password to program without bothering user

I have problem with point 3. Unfortunately this program cannot take password as argument.
I was trying some variations with System.Diagnostic.Process but without results.

Is it possible to write such an application? I'm not asking for full solution, just information what should I look for will be great.

Is This A Good Question/Topic? 0
  • +

Replies To: Is it possible to automatic response for command prompt in console?

#2 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5106
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Is it possible to automatic response for command prompt in console?

Posted 18 October 2012 - 07:17 AM

If that program takes its input on STDIN, you can use the ProcessStartInfo class to redirect standard input and send your own input. (Here's an example: http://msdn.microsof...ndardinput.aspx )

You'll probably also want to redirect standard output, so you can just output all the text in one window.
Was This Post Helpful? 0
  • +
  • -

#3 lukasz_ltt   User is offline

  • New D.I.C Head

Reputation: 18
  • View blog
  • Posts: 29
  • Joined: 12-October 12

Re: Is it possible to automatic response for command prompt in console?

Posted 18 October 2012 - 12:36 PM

Thanks for reply, but in my case this works only in output. When I'm trying to use StandardInput two things happens:
- executed program in procces ends before I can send anything to stdin
or
- when I'm trying to use WaitForInputIdle() method program crashes, because git.exe is not GUI application


Solution for my problem I found in TortoiseGit. It's open source, so I should dig out how they did it and then post it here.... might be usefull for someone
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1