windows 让批处理文件最小化 DOS 窗口?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/775703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:20:14  来源:igfitidea点击:

Letting a Batch file Minimize a DOS window?

windowsminimizeshrink

提问by billyy

So i'm kinda into MS-DOS and such again, but i came to ask myself, How can i minimize a DOS window? Any kind would be ok, minimalize, shrink to a tiny blue block.

所以我有点喜欢 MS-DOS 等等,但我开始问自己,我怎样才能最小化 DOS 窗口?任何一种都可以,最小化,缩小到一个小的蓝色块。

I just can't seem to find a way to let it work on my Windows XP computer, is realy evrything excluded in XP?!

我似乎无法找到一种方法让它在我的 Windows XP 计算机上运行,​​XP 中真的不包括所有内容吗?!

回答by Greg Hewgill

You can start a program in a new minimised window using the startcommand:

您可以使用以下start命令在新的最小化窗口中启动程序:

start /min your_command_here

回答by zdan

One thing you could do is create a windows program that will find the title of the cmd window you are running in and in that program minimize it. In Win32 you would use the FindWindowcommand to get a window handle, then CloseWindowto minimize it. Something like this totally untestedprogram:

您可以做的一件事是创建一个 Windows 程序,该程序将找到您正在运行的 cmd 窗口的标题,并在该程序中将其最小化。在 Win32 中,您将使用FindWindow命令获取窗口句柄,然后使用CloseWindow将其最小化。像这个完全未经测试的程序:

int main(int argc, char** argv)
{
    HWND wnd = FindWindow(      
        NULL,
        argv[1]
        );
    CloseWindow(wnd);
    return 0;
} 

Within the cmd window you could set the title to some string that you define (to avoid ambiguities) and then pass that name to the program to your program:

在 cmd 窗口中,您可以将标题设置为您定义的某个字符串(以避免歧义),然后将该名称传递给您的程序:

C:\>title TitleOfWindowToMiniMize

C:\>minimizeWindow TitleOfWindowToMiniMize

回答by Joey

You can't. Not in DOS. DOS has no concepts of windows.

你不能。不在 DOS 中。DOS 没有 windows 的概念。

In Windows you could write a little program that will look up your window and send it the appropriate message causing it to minimize. The same way you could also maximize or hide/show your window.

在 Windows 中,您可以编写一个小程序来查找您的窗口并向其发送适当的消息,使其最小化。同样,您也可以最大化或隐藏/显示您的窗口。