File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to open a hidden command window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to open a hidden command window" Watch "How to open a hidden command window" New topic
Author

How to open a hidden command window

Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
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

Joined: Oct 30, 2001
Posts: 1970
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.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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?


[Jess in Action][AskingGoodQuestions]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
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
Marshal

Joined: Mar 22, 2005
Posts: 42596
    
  65
This sounds like a very unusual client/server design. You should have just a single server process, not one for each client.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to open a hidden command window