Hiding cmd promt window

S

Shyam Prakash

Hello All,

I am puzzled over how to hide the cmd prompt window??

mycopy.exe copies a know set of files from one location to the other.
Here I am struggling to hide / supress the cmd prompt window which stays
until the process is exited.

<code snippet>

Process proc = new Process();
proc.StartInfo.FileName = @"mycopy.exe";
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.hidden;
proc.Start();
proc.WaitForExit();
proc.Close();

</code snippet>

Upon a few browses, I understood that, ProcessWindowStyle works well for
the application invoked (for ex, notepad through a cmd prompt) but not
on the cmd prompt itself.

Can anyone please help me in how to overcome this?.
Thanks in advance
../Shyam
 
K

Ken Cox [Microsoft MVP]

Why don't you turn mycopy.exe in .NET code so you can call it directly in
your page and bypass the command prompt altogether?
 
S

Shyam Prakash

Hello Ken,

That will do for my own code but in case mycopy.exe is a third party
tool then how to handle that??

Even in a simple case where I open a Notepad.exe, I get the cmd prompt
window.

Thanks
./Shyam
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top