9

anybody know how to minimize the command prompt when running a batch script in Windows 3.11?

in Windows XP, there have a command

start /min start.bat 

to minimize the cmd prompt, is it have similiar command in MSDos 6.22?

issac
  • 125
  • 1
  • 1
  • 6

5 Answers5

18

This little batch code should do what you need.

http://zoombody.com/articles/run-a-batch-script-minimized

The relevant code then needs to be placed at the top of your script:

if not "%minimized%"=="" goto :minimized
set minimized=true
start /min cmd /C "%~dpnx0"
goto :EOF
:minimized
rem Anything after here will run in a minimized window

Here is more information about "%~dpnx0".

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
rbprogrammer
  • 199
  • 1
  • 3
6

There isn't a command that you can use from a DOS prompt, however you can create a PIF file that points to your batch file, in which you can set the default window position (including minimized).

...I think. It's been a couple of decades.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
1

How to minimize the current command prompt:

Purpose:

  1. Close a command prompt after execution.
  2. Open a new command prompt using the same path.

First open command prompt : Hold down the [Windows] + [R] keys.

Go to this location:

C:\>cd Users\Admin\Desktop

Next excute:

C:\Users\Admin\Desktop>start /min && exit

Results:
  A new minimized command prompt should open with the same path.

Alternatively:
Create a script named minimize.bat and type start /min && exit into the script and place it in your system32 folder. In order to have the ability to access it via the command prompt.

denezt
  • 11
  • 2
1

Windows 10 makes it very easy to start minimized. Simply create a shortcut and click properties. On the shortcut tab half way down is the "Run:" option witch lets you select how you want the command line window to start up. Just select minimized and your command window will remain minimized from the onset. Windows10 properties window of a shortcut

-4

Use WinExec to start your batch file and pass SW_SHOWMINIMIZED for the second parameter.

See also, How do I run a batch file with WinExec?

Community
  • 1
  • 1
Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
  • 1
    and how will you start the batch file with the `WinExec`? – Jimmy Obonyo Abor Apr 02 '13 at 19:40
  • The same way you start anything else with `WinExec`, @Jimmy. For details, post a question on Stack Overflow. – Rob Kennedy Apr 02 '13 at 20:49
  • 2
    I didn't really think my answer needed explaining, @Araisbec. Answering Jimmy here wouldn't have helped him anyway; the question he asked 15 minutes later shows that he was *writing* a batch file, not starting one, and thus couldn't even have used `WinExec`. Besides, *this* question isn't even *about* `WinExec`. Others who want to know how to use it independently of minimizing batch files wouldn't bother to click on this question anyway, so why bury the information here? It really belongs in its own question. Happy now? – Rob Kennedy Dec 18 '13 at 19:03
  • 1
    newer programs should use ShellExecute() with 'nShowCmd' argument set to SW_MINIMIZE – dns Nov 05 '14 at 14:40