• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to open a hidden command window

 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi from my java code I am opening a command window in minimized way that is the pop up is opening and get minimized and remains in the below of my desktop.
I am using the following syntax

Runtime.getRuntime().exec("cmd.exe /c start /MIN " + command);

I don't want it to be in minimized form I want this window to be hidden ..
So that from my desktop I cant see the application is running with a minimized pop up .

Can anybody help me on this . I want a java code that will start the commanad windown in hidden mode .
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with Java, does it? You want to know whether Windows CMD.EXE has the facility to run hidden, and it looks like it doesn't. Java can't hide some other application's (i.e. CMD's) window.
 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just want a solution If this can't be possible in Java its ok but there must be a way to hide the window . How I can hide the window ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Monoj Roy:
I just want a solution If this can't be possible in Java its ok but there must be a way to hide the window . How I can hide the window ?


You'd have better luck asking on a Windows forum of some kind, yes? Java programmers aren't going to be the best resource for answering this kind of question.

But you've got me curious, anyway. Please tell us why you want to do this? What good is an invisible CMD.EXE window?
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on what the command is. Sometimes you just want it to do some processing without the window, and capture its output.

That said, calling "start" will not be logical. Just "CMD.exe /c " + command should be enough. It's the "start" part that creates the new window.
 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you guys a lot for all of yours helping hand .

Just to answer Ernest Friedman-Hill Why I need to hide the window ..Here is the story

I am writing an application for a client server model using RMI where there will be N no of client at a time can access the Server . I am dome with that but the problem is when each client calls the server a new java program is invoked and it opens up with a new window in the server side. Its very common that if there are 100 clients supported by the server no programmer allow 100 pop up window opens up in the server side .

So I want to start them such a way so that it can run in the back side .

Thanks every one for your support . Thanks a lot .
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like a very unusual client/server design. You should have just a single server process, not one for each client.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic