none
Send keys to command prompt

    Question

  • I have an application that will open a command prompt (cmd.exe), and then types "ipconfig/renew". How do I send the enter key, to execute the command?

    So far i have:
    Process.Start("cmd.exe")
    My.Computer.Keyboard.SendKeys("ipconfig/renew")
    My.Computer.Keyboard.SendKeys(Keys.Enter)
    When I use "Keys.Enter", it sends "13". How do I make it press Enter, not put "13" on the command line?
    Monday, May 25, 2009 2:07 AM

Answers

  • Hi,

    try to use like this.

    My.Computer.Keyboard.SendKeys("{enter}")
    this may help!!
    • Marked as answer by bornapilot Monday, May 25, 2009 2:32 AM
    Monday, May 25, 2009 2:17 AM

All replies

  • Try to use,

     System.Windows.Forms.SendKeys.SendWait("{ENTER}")


    Best Regards,
    Lucas Luo
    Monday, May 25, 2009 2:14 AM
  • Hi,

    try to use like this.

    My.Computer.Keyboard.SendKeys("{enter}")
    this may help!!
    • Marked as answer by bornapilot Monday, May 25, 2009 2:32 AM
    Monday, May 25, 2009 2:17 AM
  • Thank you so much for that. I'm only 13 and trying to figure out the VB lingo, that was the last thing I needed to complete my application! Thank You!
    Monday, May 25, 2009 2:33 AM