Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Hide the command window

Hide the command window

Scheduled Pinned Locked Moved C#
questioncsharp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sheela Krishnan
    wrote on last edited by
    #1

    Hi, I execute a command from inside my C# program. So the cmd window comes up when the processing realted to the command window is in execution. How do I hide the window programmatically? Here is what i do to execute the command from within the code..... System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo = new System.Diagnostics.ProcessStartInfo(command, commandLineArg); process.Start(); Pls reply asap! Thanks, Sheela

    S D 2 Replies Last reply
    0
    • S Sheela Krishnan

      Hi, I execute a command from inside my C# program. So the cmd window comes up when the processing realted to the command window is in execution. How do I hide the window programmatically? Here is what i do to execute the command from within the code..... System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo = new System.Diagnostics.ProcessStartInfo(command, commandLineArg); process.Start(); Pls reply asap! Thanks, Sheela

      S Offline
      S Offline
      Steven Campbell
      wrote on last edited by
      #2

      I have not tried this, but... There are StandardError, StandardInput and StandardOutput streams properties on a Process. If you were to assign your own streams to those properties, it should/could/may cause the window to not display.


      my blog

      1 Reply Last reply
      0
      • S Sheela Krishnan

        Hi, I execute a command from inside my C# program. So the cmd window comes up when the processing realted to the command window is in execution. How do I hide the window programmatically? Here is what i do to execute the command from within the code..... System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo = new System.Diagnostics.ProcessStartInfo(command, commandLineArg); process.Start(); Pls reply asap! Thanks, Sheela

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        In your ProcessStartInfo object, try setting the WindowStyle property to Hidden before you start your process.

        System.Diagnostics.Process process = new System.Diagnostics.Process();
        process.StartInfo = new System.Diagnostics.ProcessStartInfo(command, commandLineArg);
        process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        process.Start();

        RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        S 1 Reply Last reply
        0
        • D Dave Kreskowiak

          In your ProcessStartInfo object, try setting the WindowStyle property to Hidden before you start your process.

          System.Diagnostics.Process process = new System.Diagnostics.Process();
          process.StartInfo = new System.Diagnostics.ProcessStartInfo(command, commandLineArg);
          process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
          process.Start();

          RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          S Offline
          S Offline
          Sheela Krishnan
          wrote on last edited by
          #4

          This helped... thanks!:)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups