在 Windows 中使用命令文件自动定位应用程序窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1147949/
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
Automatically Position Application Window Using Command File in Windows
提问by gvkv
I'm using PuTTY to access my BSD file server and I have several terminal windows open at once. I wrote a simple command file to automate opening the terminal windows and I'd like to know if it is possible to place them at a specific location.
我正在使用 PuTTY 访问我的 BSD 文件服务器,并且我同时打开了多个终端窗口。我编写了一个简单的命令文件来自动打开终端窗口,我想知道是否可以将它们放置在特定位置。
I have two monitors and as it is now, I have to manually drag the terminal windows over to my second monitor.
我有两台显示器,就像现在一样,我必须手动将终端窗口拖到我的第二台显示器上。
回答by demoncodemonkey
AFAIK you can't do it directly from a batch file without using some 3rd party software like AutoHotkey.
AFAIK 如果不使用AutoHotkey等某些 3rd 方软件,您就无法直接从批处理文件中执行此操作。
It makes it incredibly easy to move a window. For examplethis script would start Calculator and move it to the top-left corner:
它使移动窗口变得非常容易。对于例如该脚本将启动计算器,并将其移动到左上角:
Run, calc.exe
WinWait, Calculator
WinMove, 0, 0
You can also easily compile your script into an .exe if you want to share it with other people that don't have AHK installed. It will basically answer all your automation needs, just as it has done mine :)
如果您想与未安装 AHK 的其他人共享它,您还可以轻松地将脚本编译为 .exe。它基本上可以满足您所有的自动化需求,就像它对我的一样:)