Home All Groups Group Topic Archive Search About
Author
13 May 2005 2:18 PM
Brian Shafer
Hello,
I want to execute a simple command...
ipconfig /all > c:\ipconfig.txt

then once I do that.. read the file...
the only thing i can't seem to get is the command? How can I run this from VB?
Brian

Author
13 May 2005 2:23 PM
Ken Halter
"Brian Shafer" <Brian Sha***@discussions.microsoft.com> wrote in message
news:F29C134A-7764-4352-9773-0DF07F267DFC@microsoft.com...
> Hello,
> I want to execute a simple command...
> ipconfig /all > c:\ipconfig.txt
>
> then once I do that.. read the file...
> the only thing i can't seem to get is the command? How can I run this from
> VB?
> Brian

Have you tried.....

Shell "ipconfig /all > c:\ipconfig.txt"

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Sign up now to help keep VB support alive - http://classicvb.org/petition
Please keep all discussions in the groups..
Author
13 May 2005 2:44 PM
Brian Shafer
Yes, I have tried that

Show quote
"Ken Halter" wrote:

> "Brian Shafer" <Brian Sha***@discussions.microsoft.com> wrote in message
> news:F29C134A-7764-4352-9773-0DF07F267DFC@microsoft.com...
> > Hello,
> > I want to execute a simple command...
> > ipconfig /all > c:\ipconfig.txt
> >
> > then once I do that.. read the file...
> > the only thing i can't seem to get is the command? How can I run this from
> > VB?
> > Brian
>
> Have you tried.....
>
> Shell "ipconfig /all > c:\ipconfig.txt"
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> Sign up now to help keep VB support alive - http://classicvb.org/petition
> Please keep all discussions in the groups..
>
>
>
Author
13 May 2005 2:50 PM
Bob Butler
"Brian Shafer" <Brian Sha***@discussions.microsoft.com> wrote in
message news:9C6A1CD2-921A-450A-852D-9BF2A83F5CE3@microsoft.com
> Yes, I have tried that
>> Shell "ipconfig /all > c:\ipconfig.txt"

In order to re-direct to a file you have to shell the command environment

shell environ$("comspec") & " /c ipconfig /all > c:\ipconfig.txt"

That said, it'd be better to use WMI and/or API calls to get the information
directly rather than usign a methid like this.  If you do use the Shell
method you'll either need to pause or use one of the "Shell and Wait"
methods because your code will continue before the IPConfig utility finishes
running.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
13 May 2005 4:03 PM
Brian Shafer
Awesome.. thanks

Show quote
"Bob Butler" wrote:

> "Brian Shafer" <Brian Sha***@discussions.microsoft.com> wrote in
> message news:9C6A1CD2-921A-450A-852D-9BF2A83F5CE3@microsoft.com
> > Yes, I have tried that
> >> Shell "ipconfig /all > c:\ipconfig.txt"
>
> In order to re-direct to a file you have to shell the command environment
>
> shell environ$("comspec") & " /c ipconfig /all > c:\ipconfig.txt"
>
> That said, it'd be better to use WMI and/or API calls to get the information
> directly rather than usign a methid like this.  If you do use the Shell
> method you'll either need to pause or use one of the "Shell and Wait"
> methods because your code will continue before the IPConfig utility finishes
> running.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
>

AddThis Social Bookmark Button