Process.Start to run .bat file, need to hide command window

G

Guest

I need to run multiple .bat files(in specific order, sychronously) from my C#
windows app. I also want to hide the DOS command window so that users don't
see them.

Basically my program lanches .bat file to do some installation, status of
the installation will be displayed on the windows app, but don't want the dos
window showed.

I look at Microsoft.VisualBasic.Interaction.Shell, that Shell out command is
asynchronous, right? If it is, I cannot use it.
 
G

Guest

Use SHELL to launch your batch files minimized without focus. It will still
show in the taskbar, but not on screen
 
S

Shariq Khan

James:

You can use the System.Diagnostics.Process.Start() method to start a
process. By using the ProcessStartInfo class, you can control several
aspects of the process being launched including showing the window or not,
wait for the process to complete. You can also redirect and hence capture
the output of the DOS program.

See
http://msdn.microsoft.com/library/d...nosticsprocessclassgetcurrentprocesstopic.asp
and
http://msdn.microsoft.com/library/d...nosticsprocessclassgetcurrentprocesstopic.asp

Hope this helps!

Shariq Khan
(e-mail address removed)
 
G

Guest

I disagree with the Process.Start method because it will still run normal
foucus & the user doesn't want that. This is why I suggested the SHELL method
because you can pass 'Minimize No Focus' as a parameter

The ProcessStartInfo is used to start the application in a program other
than the default.
 
T

Tom Porterfield

I disagree with the Process.Start method because it will still run normal
foucus & the user doesn't want that. This is why I suggested the SHELL method
because you can pass 'Minimize No Focus' as a parameter

The ProcessStartInfo is used to start the application in a program other
than the default.

If you use ProcessStartInfo and set the WindowStyle to
ProcessWindowStyle.Hidden then you won't see an item in the taskbar, nor
any window. You can also specify UseShellExecute to true if you want the
equivalent behavior to using Shell.
 

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