Shell command in Visual Basic

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

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
 
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.NormalFocus)

which executes any shell command and remains at the window.

Regards,

Onur Güzel
 
Michael,
This syntax will work for you:

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

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.NormalFocus)

Regards,

Onur Güzel
 
Back
Top