|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
dos command lineHello,
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 "Brian Shafer" <Brian Sha***@discussions.microsoft.com> wrote in message Have you tried.....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 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.. 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.. > > > "Brian Shafer" <Brian Sha***@discussions.microsoft.com> wrote in In order to re-direct to a file you have to shell the command environmentmessage news:9C6A1CD2-921A-450A-852D-9BF2A83F5CE3@microsoft.com > Yes, I have tried that >> Shell "ipconfig /all > c:\ipconfig.txt" 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..." 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..." > >
Other interesting topics
|
|||||||||||||||||||||||