如何通过cmd最大化特定窗口?(windows)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14760518/
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-09 10:14:54  来源:igfitidea点击:

How can i maximize a specific window through cmd?(windows)

windowscommand-linecommand-promptmaximize-window

提问by Bruno Charters

I just wanna make a simple notepad .bat file that would maximize a specific process window. Is that possible?

我只想制作一个简单的记事本 .bat 文件,可以最大化特定的进程窗口。那可能吗?

回答by Anirudh Ramanathan

Starttakes an argument to do that.

Start需要论证来做到这一点。

START /MAX notepad.exe

However, if it an already running instance, it is outside cmd's control.

但是,如果它是一个已经在运行的实例,则它不受 cmd的控制。

回答by npocmaka

If you want to maximize already running program/window you can try with windowMode.batusing its title (or a string that the title starts with)

如果您想最大化已经运行的程序/窗口,您可以尝试使用windowMode.bat使用其标题(或标题开头的字符串)

@echo off
call windowMode -title "Notepad" -mode maximized

or with its process id:

或使用其进程 ID:

@echo off
call windowMode -pid 1313 -mode maximized