473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
Mar 31 '08 #1
2 3287
On Mar 31, 8:00 pm, Michael <bgreer5...@gmail.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.NormalFocus)

which executes any shell command and remains at the window.

Regards,

Onur Güzel
Mar 31 '08 #2
On Mar 31, 8:06 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Mar 31, 8:00 pm, Michael <bgreer5...@gmail.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.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
Mar 31 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Steen Gellett | last post by:
How can I make a program halt, so when shell command is finished my program continues, but as long as the shell is running it must be on "hold" ??
9
by: Amjad | last post by:
I'm trying to create a folder, append text file to another, and delete files using the "Shell" command. But I always get the error "File Not Found". How do I use DOS commands from Visual Basic?...
1
by: ckirby | last post by:
I've inherited an application for creating mail merges from an Access 2003 ADP that needs an overhaul. To generate the mail merge , the app uses a shell command: result = Shell(str, vbHide) ...
12
by: Dixie | last post by:
Is there a way to shell to Microsoft Word from Access and load a specific template - using VBA? dixie
5
by: bearophileHUGS | last post by:
For array.array "B" means unsigned char, and such arrays accept to be initialized from (str) strings too, this is quite useful: But it seems such capability isn't shared with the append: ...
2
by: Lee Kok Onn | last post by:
I have write the following command in visual studion visual basic 2005. shell("runas /user:admin diskpart") to set the hard disk partition. it will prompt user to type a password in dos prompt,...
4
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of API. Actually I have the need for such pattern for...
7
by: godhulirbalaka | last post by:
Hi guys, I am making a shop management program in visual basic. I want to a menu name Utiliti where Calculator, notepad, heart game, solitair game will be shown. In Utility menu I added this submenu....
1
risk32
by: risk32 | last post by:
I seem to be having a "brain fart" with the Shell() command for Visual Basic. Either that, or what I'm trying to can't be done and I'm just a noob for trying. Anyways, here's what I'm trying to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.