473,484 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DOS Output in VB

20 New Member
Hi all,

I have a problem that i m not getting how to solve that.

I want to execute dos commands from VB6 and want to see the output in a textbox present in the form.

For example i execute ipconfig command from vb6 then i want to see the output in a textbox.

Now plz guide me how to execute dos commands from vb6 so that i can see the output in a textbox.

Thanx
Aug 19 '10 #1
1 4786
Guido Geurs
767 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  3.  
  4. Private Sub Command1_Click()
  5. Dim INPUTTEXT As String
  6. Dim DOSSHELL As Variant
  7. Dim FNum As Integer
  8.    On Error GoTo Error_Start
  9. '§ DOS command
  10.    DOSSHELL = Shell("C:\windows\system32\cmd /C ipconfig > c:\ipconfig.txt ", 0)
  11. '§ wait 6 sec
  12.    Sleep 6000
  13. '§ read the results
  14.    FNum = FreeFile()
  15.    On Error GoTo Error_Open
  16.    Open "c:\ipconfig.txt" For Input As #FNum
  17.       Do While Not EOF(FNum)
  18.          Input #FNum, INPUTTEXT
  19.          Text1.Text = Text1.Text & INPUTTEXT & vbCrLf
  20.       Loop
  21.    Close #FNum
  22. Exit Sub
  23. Error_Start:
  24.    MsgBox ("There is an Error in executing the DOS command")
  25. Exit Sub
  26. Error_Open:
  27.    MsgBox ("There is an Error in opening the file")
  28. End Sub
Aug 21 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
8118
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
3
2766
by: edgekaos | last post by:
Is method 2 valid? Method 1: wstring input = L"STRING"; wstring output = input; transform(output.begin(), output.end(), output.begin(), towupper); Method 2: wstring input = L"STRING";...
4
15034
by: Kevin Mansel via .NET 247 | last post by:
Ok, basically this is my problem. I'm building a console app tocall a dos program. So i'm using the Shell command to call theprogram, now depending on what happens, I want to read theoutput that...
24
2660
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
0
2045
by: newbie | last post by:
i'm a newbie of c language. can anyone help me to implement the code so that I can get the ciphertext from the output. thanks. #ifndef _3DES_H #define _3DES_H #ifndef uint8 #define uint8 ...
32
2730
by: spibou | last post by:
Is the output of the C preprocessor deterministic ? What I mean by that is , given 2 compilers which conform to the same standard, will their preprocessors produce identical output given as input...
3
2609
by: MatsL | last post by:
Hi, This is seriously driving me crazy, could anyone explain to me why neither of these doesn't produce XHTML compliant output (it is being called in Render() btw): output.WriteLine("<img...
3
4638
by: undshan | last post by:
I am writing a code that needs to open a file, create an output file, run through my function, prints the results to the output file, and closes them within a loop. Here is my code: #include...
5
3307
by: amit.uttam | last post by:
Hey everyone, I've recently jumped big time into python and I'm working on a software program for testing automation. I had a question about proper logging of output. What I would like is: 1....
2
3355
by: gabosom | last post by:
Hi! I've been breaking my head trying to get the output variables from my Stored Procedure. This is my SP code CREATE PROCEDURE GetKitchenOrderDetail( @idService int, --outPut Variables ...
0
7082
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6953
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
7105
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7144
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...
1
6813
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7214
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...
0
4529
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3046
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.