Letting a Batch file Minimize a DOS window?

北城以北 提交于 2019-12-01 22:30:29

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 FindWindow command to get a window handle, then CloseWindow to minimize it. Something like this totally untested program:

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:

C:\>title TitleOfWindowToMiniMize

C:\>minimizeWindow TitleOfWindowToMiniMize

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

start /min your_command_here

You can't. Not in DOS. DOS has no concepts of 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!