开发者

how to minimize the command prompt when running a batch script?

开发者 https://www.devze.com 2022-12-17 09:54 出处:网络
anybody know how to minimize the command promp开发者_C百科t when running a batch script in Windows 3.11?

anybody know how to minimize the command promp开发者_C百科t 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?


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".


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.


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.


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


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号