By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,482 Members | 1,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,482 IT Pros & Developers. It's quick & easy.

Shell to DOS

P: n/a
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.

Mar 27 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"ngr" <ng*@tdrd.freeserve.co.uk> schreef in bericht
news:o9********************@karoo.co.uk...
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.

Mar 27 '06 #2

P: n/a
ngr wrote:
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
--
Rinze van Huizen
C-Services Holland b.v
Mar 27 '06 #3

P: n/a
ngr,

You can try this one on our website

http://www.vb-tips.com/default.aspx?...b-23cab5aa1049

I hope this helps,

Cor

"ngr" <ng*@tdrd.freeserve.co.uk> schreef in bericht
news:o9********************@karoo.co.uk...
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.

Mar 27 '06 #4

P: n/a
"ngr" <ng*@tdrd.freeserve.co.uk> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 27 '06 #5

P: n/a
ngr
Resolved the piping issue by creating a batch file and calling that
directly.
Messy but it works.

Terry

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OP****************@TK2MSFTNGP10.phx.gbl...
"ngr" <ng*@tdrd.freeserve.co.uk> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 27 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.