Shell command in Visual Basic

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael

    Shell command in Visual Basic

    I have an on-click event, where I would like the machine to release
    it's IP address:

    Shell("ipconfig /release")

    Why does this not work ?
    What is the proper way to do this ?

    Thanks
  • kimiraikkonen

    #2
    Re: Shell command in Visual Basic

    On Mar 31, 8:00 pm, Michael <bgreer5...@gma il.comwrote:
    I have an on-click event, where I would like the machine to release
    it's IP address:
    >
    Shell("ipconfig /release")
    >
    Why does this not work ?
    What is the proper way to do this ?
    >
    Thanks
    Michael,
    This syntax will work for you:

    Shell("cmd.exe /k ipconfig /all", AppWinStyle.Nor malFocus)

    which executes any shell command and remains at the window.

    Regards,

    Onur Güzel

    Comment

    • kimiraikkonen

      #3
      Re: Shell command in Visual Basic

      On Mar 31, 8:06 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
      On Mar 31, 8:00 pm, Michael <bgreer5...@gma il.comwrote:
      >
      I have an on-click event, where I would like the machine to release
      it's IP address:
      >
      Shell("ipconfig /release")
      >
      Why does this not work ?
      What is the proper way to do this ?
      >
      Thanks
      >
      Michael,
      This syntax will work for you:
      >
      Shell("cmd.exe /k ipconfig /all", AppWinStyle.Nor malFocus)
      >
      which executes any shell command and remains at the window.
      >
      Regards,
      >
      Onur Güzel
      Sorry, just change "ipconfig /all" with "ipconfig /release";

      And if you don't want to see command prompt window after executing
      shell command any longer , use "/c" switch instead of "/k" switch for
      cmd.exe as follows:

      Shell("cmd.exe /c ipconfig /release", AppWinStyle.Nor malFocus)

      Regards,

      Onur Güzel

      Comment

      Working...