Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling DOS commands in VB

Status
Not open for further replies.

rossmcl

Programmer
Apr 18, 2000
128
Hi

I have a VB form that I want to display some information normally got via DOS prompt, namely

net user USERNAME /domain |more

Is there any way if calling this in VB so the result is displayed in a VB text box?

Any help would be much appreciated.

rossmcl
 
I'm sure there's a better way, but you could pipe the DOS command to a file and then read the file into VB to populate your msgbox.....
 
Get All DOS Environment Variables

An example of DOS Environment variables:

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND
BLASTER=A220 I7 D1 T2
PROMPT=$p$g
winbootdir= C:\WINDOWS

Preparations
Add 1 Command Button and 1 Text Box to your form.
Set the Text Box MultiLine property to True.

Form Code
Private Sub Command1_Click()
Dim Env As String
Dim x As Integer
x = 1
Env = Environ(x)
Text1 = ""
Do Until Env = ""
Env = Environ(x)
Text1 = Text1 + Env & vbNewLine
x = x + 1
Loop
End Sub

Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
hi
i am printing 1000 lines of file in dos with epson printer. it gives some space between pages. i think it follows a4 paper size. BUT I want print the file with out leaving space between pages
is there any way? pl. help me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top