Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to hide command in DOS window

11 views
Skip to first unread message

Lynn

unread,
Mar 11, 2006, 12:09:02 PM3/11/06
to
Hi,
I am using Process.Start("C:\file.exe") to start file.exe on my computer
with vb.net.
when it runs, a DOS window pops up showing what file.exe is doing. How can I
prevent DOS from displaying the command that i am running (ie. file.exe) ?
thanks


newbie

unread,
Mar 12, 2006, 11:52:20 AM3/12/06
to
Install msdn and search ....

Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(startInfo)

"Lynn" <Marr...@yah00.c0m> schreef in bericht
news:%232Emp4S...@TK2MSFTNGP09.phx.gbl...

Lynn

unread,
Mar 13, 2006, 7:11:14 AM3/13/06
to
if i use this code, how can i program it to wait for file.exe to finish
running before moving on to other stuffs?

Sam Hobbs

unread,
Mar 13, 2006, 8:04:51 AM3/13/06
to
This is a separate question that was asked recently in this group, I think
by you.

So for the benefit of others at least, note that answers have been provided
previously and any answers provided here might be duplicates.


"Lynn" <moley...@yahoo.com.au> wrote in message
news:1142251874.2...@z34g2000cwc.googlegroups.com...

Lynn

unread,
Mar 13, 2006, 9:53:05 AM3/13/06
to
sorry, i just started vb.net
i know it is using WaitForExit()
but i can't get it to work using the code that you have provided.
can you help?

"Sam Hobbs" <sam...@social.rr.com_change_social_to_socal> wrote in message
news:ekzr06p...@TK2MSFTNGP10.phx.gbl...

newbie

unread,
Mar 14, 2006, 10:20:43 AM3/14/06
to
you don't learn by asking how you have to do something.
You learn something to buy and read / learn the book / research on the
internet ( like google )
and ofcourse a lot of MSDN. Try to work with msdn, it is a very very usefull
"tool"

Dim p As New Process()
p.StartInfo.FileName = "IExplore.exe"
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal 'or
ProcessWindowStyle.Hidden
p.Start() 'start the process
'System.Threading.Thread.Sleep(1000) 'wait 1 second = 1000 ms
'p.WaitForExit() 'start waiting for IEXPLORE.exe to quit.
'p.Kill() ' kill / stop the progress

That are some usefull commands for you.

Look, you knew it was something with "waitforexit"
google --> VB.NET + waitforexit --> click on first hit.
See ? you could find it by yourself...


"Lynn" <Marr...@yah00.c0m> schreef in bericht

news:OCsyD2qR...@TK2MSFTNGP11.phx.gbl...

Gerry Hickman

unread,
Mar 14, 2006, 5:06:26 PM3/14/06
to
newbie wrote:

> you don't learn by asking how you have to do something.
> You learn something to buy and read / learn the book / research on the
> internet ( like google )
> and ofcourse a lot of MSDN.

Well said.

> Dim p As New Process()
> p.StartInfo.FileName = "IExplore.exe"
> p.StartInfo.WindowStyle = ProcessWindowStyle.Normal 'or
> ProcessWindowStyle.Hidden
> p.Start() 'start the process
> 'System.Threading.Thread.Sleep(1000) 'wait 1 second = 1000 ms
> 'p.WaitForExit() 'start waiting for IEXPLORE.exe to quit.
> 'p.Kill() ' kill / stop the progress
>
> That are some usefull commands for you.

Interesting, but is this WMI?

--
Gerry Hickman (London UK)

Lynn

unread,
Mar 15, 2006, 6:03:30 AM3/15/06
to
thanks for the comments guys.
I am trying to google why waitforexit hangs my windows form when i execute
the dos program.
your help is very much appreciated


"Gerry Hickman" <gerry...@yahoo.co.uk> wrote in message
news:uvynzN7R...@TK2MSFTNGP12.phx.gbl...

newbie

unread,
Mar 15, 2006, 7:16:33 AM3/15/06
to
what do you mean ?

hangs = CPU 100% load ?
hangs = cant push button , ... ?

"Lynn" <Marr...@yah00.c0m> schreef in bericht

news:ODYyK$BSGH...@TK2MSFTNGP12.phx.gbl...

Lynn

unread,
Mar 15, 2006, 8:24:12 AM3/15/06
to
my windows form turns white (hang). while the dos box is running.

newbie

unread,
Mar 15, 2006, 3:20:24 PM3/15/06
to
that is normal....
Because it is waiting, so it does'nt repaint himself.
if you maximize / minimze / maximize / resize / move
a window repaints himself. ( repaint all the objects , VB.NET does that for
you. )

Shell("C:\Program Files\Internet Explorer\iexplore.exe",
AppWinStyle.NormalFocus, True)

this will also "hang"

when you says, wait for return .... it waits ( and don't repaint himself )
So actually it doesn't hang..
Why do you have to wait to end that program internet explorer ?
Maybe If you explain what you want to do I can help you...

"Lynn" <moley...@yahoo.com.au> schreef in bericht
news:1142429052....@u72g2000cwu.googlegroups.com...

newbie

unread,
Mar 15, 2006, 3:26:33 PM3/15/06
to
what are you trying to do ???
you want to run a internet explorer at the background of your program.
AND you want to run a program on a remote pc ?


"Lynn" <Marr...@yah00.c0m> schreef in bericht

news:%232Emp4S...@TK2MSFTNGP09.phx.gbl...

Sam Hobbs

unread,
Mar 15, 2006, 4:49:51 PM3/15/06
to
What you are trying to do is quite advanced. Starting a process and then
waiting for it to complete is relatively advnced. Communicating with the
process that was started is more complicated, but I am not sure if that is
something you are also asking about. If you need to get the other process to
stop, then that requires communicating with the process; programmers should
never use "Kill" or methods similar to that to get a processes to stop. Kill
should be used in emergency situations when the normal methods don't work;
Kill should not be part of the normal design.

I am not familiar with VB.Net, so I can't help with that. Your original
question asks how to use:

Process.Start("C:\file.exe")

I don't know if that is WMI but if not then you should ask in a VB.Net
newsgroup or whatever newsgroup is most relevant to "Process.Start". I don't
understand how a "DOS Window" is relevant. Perhaps the program is not
actually a DOS program and the window is not a DOS window. People often call
"console" or "command prompt" programs and windows DOS programs and windows
and the solutions for each are usually different.

I think it would have helped if you had shown more code or at least
specified what "Process" in "Process.Start" is. There are many ways to do
what you need to do and the solution probably depends on many details that
you have not provided. Probably you don't need WMI and whether you do or do
not, you need to describe better what it is that you need to do. Discussions
will always grow large without providing answers if the problem is not
described well enough.


"Lynn" <Marr...@yah00.c0m> wrote in message
news:OCsyD2qR...@TK2MSFTNGP11.phx.gbl...

Sam Hobbs

unread,
Mar 15, 2006, 5:02:56 PM3/15/06
to
"newbie" <as...@aswin.be> wrote in message
news:44187705$0$29462$ba62...@news.skynet.be...

> that is normal....
> Because it is waiting, so it does'nt repaint himself.
> if you maximize / minimze / maximize / resize / move
> a window repaints himself.

This is a situation where someone is guessing and replies as if it is not a
guess. It is not normal for a window to not get repainted in the manner that
Lynn describes.

Actually a Windows program should repaint a window when needed without
requiring an occurance of a maximize / minimze / resize / move. Lynn's
program is probably not processing messages. I don't know what should be
used in a VB.Net program to process messages but in VB 6 the DoEvents
function or statement is commonly used to process messages.


newbie

unread,
Mar 17, 2006, 9:21:44 AM3/17/06
to
Process.start is the way to start a application in VB.NET
in VB6.0 --> shell
in VB.NET --> process.start


"Sam Hobbs" <sam...@social.rr.com_change_social_to_socal> schreef in bericht
news:OSbzepHS...@TK2MSFTNGP12.phx.gbl...

newbie

unread,
Mar 17, 2006, 9:24:49 AM3/17/06
to
bblablabla .....
The window does'nt repaint himself because it is waiting to end the program
( process )
application.DoEvents --> doesn't work, because he is waiting!!! That's the
point ! .
So now, you are guessing ;-)
I wasn't guessing.
application.DoEvents --> you use it if you are doing some heavy stuff.. for
instance a loop.

"Sam Hobbs" <sam...@social.rr.com_change_social_to_socal> schreef in bericht

news:OyrJlAIS...@TK2MSFTNGP14.phx.gbl...

Sam Hobbs

unread,
Mar 20, 2006, 5:26:22 PM3/20/06
to
A proper Windows program would repaint when need while waiting. If it is
waiting for anything, it should process messages while waiting. Sometimes
that might be difficult to do in VB, but if so, then it is a VB problem.
Windows provides various ways to do both: wait on an event and process
messages.


"newbie" <as...@aswin.be> wrote in message

news:441ac6ab$0$29451$ba62...@news.skynet.be...

Sam Hobbs

unread,
Mar 20, 2006, 5:59:11 PM3/20/06
to
Lynn is trying to do much more than starting an application. I am not sure
of the requirements, but it involves inter-process communication (IPC) and
possibly process synchronization. That is stuff that can get real
complicated real fast. They are topics that WMI is generally not relevant
to.

Interprocess Communications
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/interprocess_communications.asp

About Synchronization
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/about_synchronization.asp


"newbie" <as...@aswin.be> wrote in message

news:441ac5f3$0$16257$ba62...@news.skynet.be...

newbie

unread,
Mar 21, 2006, 6:50:58 AM3/21/06
to
Yes I know....
I she / he reads a book about VB.NET there is a very intresting part about
this issue... *multi threading*
Also very easy to use.
But is she doesn't understand OOP. ... start to learn the basics of the
language.


"Sam Hobbs" <sam...@social.rr.com_change_social_to_socal> schreef in bericht

news:%23J8jS1G...@TK2MSFTNGP10.phx.gbl...

0 new messages