PC Review


Reply
Thread Tools Rating: Thread Rating: 5 votes, 3.40 average.

Command prompt tool to minimize a command window AFTER it starts?

 
 
Herb Martin
Guest
Posts: n/a
 
      16th Jul 2005
I have a program which spawns a filter command (batch file) and does it by
running CMD.exe in an open window which has the annoying habit of coming
to the front and taking focus.

I need a tool to push the command prompt to the background and better to
minimize it -- my intent is to run it as the first line of the batch.

Is there a better way? (Other than fixing the stupid program which calls
it which I cannot do directly.)

--
Herb Martin, MCSE, MVP
Accelerated MCSE
http://www.LearnQuick.Com
[phone number on web site]


 
Reply With Quote
 
 
 
 
William Allen
Guest
Posts: n/a
 
      16th Jul 2005
"Herb Martin" wrote in message
> I have a program which spawns a filter command (batch file) and does it by
> running CMD.exe in an open window which has the annoying habit of coming
> to the front and taking focus.
>
> I need a tool to push the command prompt to the background and better to
> minimize it -- my intent is to run it as the first line of the batch.
>
> Is there a better way? (Other than fixing the stupid program which calls
> it which I cannot do directly.)


You can rewrite the main Batch file as a Subroutine shell, and have
the Batch file recall itself in a minimized window before passing control
to the main code and closing the initial window.

Patch your own code into this outline (where I've placed the relevant
ECHO command):

Lines that don't begin with two spaces have wrapped accidentally
====Begin cut-and-paste (omit this line)
@ECHO OFF
IF [GOTO:]==[%1] GOTO %2 {Subroutine-Handler}
start /min "CMD window" "%0" GOTO: _MAIN %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
@ECHO OFF
CLS
EXIT

GOTO EOF {=Subroutine-section-below=}
:_MAIN
FOR %%C IN (1 2 3) DO SHIFT

ECHO. Your Batch code goes here

:EOF {End-of-file}

====End cut-and-paste (omit this line)
Simulated Win2000 for study/demo use. Cut-and-paste as Batch text file.
Batch file troubleshooting: http://www.allenware.com/find?UsualSuspects

The outline passes any Batch parameters (up to %9) to the _MAIN
child shell, and restores their normal positions.

For an explanation of the unusual combo of lines:
@ECHO OFF
CLS
EXIT
to close the initial window, see our Usual Suspects page
http://www.allenware.com/find?UsualSuspects
and look under item
"Window stays open" MS-DOS window doesn't close (or closes too soon)

--
William Allen
Free interactive Batch Course http://www.allenware.com/icsw/icswidx.htm
Batch Reference with examples http://www.allenware.com/icsw/icswref.htm
Header email is rarely checked. Contact us at http://www.allenware.com/


 
Reply With Quote
 
 
 
 
Torgeir Bakken \(MVP\)
Guest
Posts: n/a
 
      16th Jul 2005
Herb Martin wrote:

> I have a program which spawns a filter command (batch file) and does it by
> running CMD.exe in an open window which has the annoying habit of coming
> to the front and taking focus.
>
> I need a tool to push the command prompt to the background and better to
> minimize it -- my intent is to run it as the first line of the batch.
>
> Is there a better way? (Other than fixing the stupid program which calls
> it which I cannot do directly.)
>

Hi,

A couple of freeware command line tools that can do this:

Min.exe
http://www.paulsadowski.com/WSH/cmdprogs.htm

ShowConsole.exe
http://groups.google.co.uk/group/mic...e=source&hl=en


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scr...r/default.mspx
 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      16th Jul 2005
In microsoft.public.win2000.cmdprompt.admin Torgeir Bakken (MVP)
wrote:

> Herb Martin wrote:
>
>> I have a program which spawns a filter command (batch file) and
>> does it by running CMD.exe in an open window which has the
>> annoying habit of coming to the front and taking focus.
>>
>> I need a tool to push the command prompt to the background and
>> better to minimize it -- my intent is to run it as the first
>> line of the batch.
>>
>> Is there a better way? (Other than fixing the stupid program
>> which calls it which I cannot do directly.)
>>

> Hi,
>
> A couple of freeware command line tools that can do this:
>
> Min.exe
> http://www.paulsadowski.com/WSH/cmdprogs.htm
>
> ShowConsole.exe
> http://groups.google.co.uk/group/mic...in2000.cmdprom
> pt.admin/msg/360bde2490a40b13?dmode=source&hl=en


And adding CMDOW.EXE
http://www.commandline.co.uk/
http://www.commandline.co.uk/cmdow/index.html
 
Reply With Quote
 
New Member
Join Date: Apr 2009
Posts: 1
 
      9th Apr 2009
I had the same kind of problem and just fixed it using the solution suggested by William.

Thanks Mr. Allen!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A useful tool, a useful tool, a useful tool, a useful tool... Hilton Microsoft Dot NET Compact Framework 2 11th Jul 2007 11:19 PM
Minimize should mean minimize =?Utf-8?B?Q01N?= Microsoft Outlook Discussion 29 14th Feb 2006 01:38 AM
how do i minimize/maximize a workbook from vba? I want to minimize it durring processing to speed things up a bit Daniel Microsoft Excel Worksheet Functions 2 9th Jul 2005 03:35 AM
how do i minimize/maximize a workbook from vba? I want to minimize it durring processing to speed things up a bit Daniel Microsoft Excel Discussion 1 9th Jul 2005 03:17 AM
problems with command prompt window and minimize/maximize on my form Laura Zeafla via .NET 247 Microsoft Dot NET 0 7th May 2004 03:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:43 PM.