Shell to DOS

P

Peter Proost

Hi maybe you can try it with a process:

Dim psi As New ProcessStartInfo
Dim p As New Process

psi.FileName = "your dos program"
psi.WorkingDirectory = "the working directory"
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.Arguments = "the arguments for your dos command"
p.StartInfo = psi
p.Start()
p.WaitForExit()

hth

Greetz Peter
 
C

C-Services Holland b.v.

ngr said:
I want to be able to shell to DOS to pipe the contents of something to a
file which can then be read in by VB.

Example

Shell to DOS and then run ROUTE PRINT > FRED.TXT

return to VB and then open fred.txt to do sometning with that.

My attempts have so far failed as no piped file has been generated whereas
it works directly from DOS.
Are you sure you're looking in the right directory for that textfile?
Your command prompt may open on a different directory then you expect
and therefore place the textfile somewhere where you don't expect it..
do a search of your system for it. Maybe you should redirect to a full
pathname i.e.

ROUTE PRINT > C:\FRED.TXT
 
N

ngr

I want to be able to shell to DOS to pipe the contents of something to a
file which can then be read in by VB.

Example

Shell to DOS and then run ROUTE PRINT > FRED.TXT

return to VB and then open fred.txt to do sometning with that.

My attempts have so far failed as no piped file has been generated whereas
it works directly from DOS.
 
H

Herfried K. Wagner [MVP]

ngr said:
I want to be able to shell to DOS to pipe the contents of something to a
file which can then be read in by VB.

Example

Shell to DOS and then run ROUTE PRINT > FRED.TXT

return to VB and then open fred.txt to do sometning with that.

My attempts have so far failed as no piped file has been generated whereas
it works directly from DOS.

You'll have to start "cmd" (or "%COMSPEC%") instead of your application
because the '>' feature is a feature of the command shell. You can pass the
command string to "cmd" in the command line.
 
N

ngr

Resolved the piping issue by creating a batch file and calling that
directly.
Messy but it works.

Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top