如何可以批处理文件中运行的程序,并设置在窗口的位置和大小? [英] How can a batch file run a program and set the position and size of the window?

查看:2969
本文介绍了如何可以批处理文件中运行的程序,并设置在窗口的位置和大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我设置的时候我写code桌面环境批处理文件。该文件名为: SetEnv.cmd 键,它会打开其他3个窗口:

I have batch file that sets up the desktop environment for me when I am writing code. The file is named: SetEnv.cmd and it opens 3 other windows:


  1. Windows资源管理器的实例,它是设置到应用服务器的部署目录。

  2. 被设置到了我的部署文件写入的目录Windows资源管理器的第二个实例。

  3. 一个控制台窗口启动我的应用程序服务器。

下面是内容 SetEnv.cmd

Explorer /n,c:\develop\jboss-4.2.3.GA\server\default\deploy
Explorer /n,c:\develop\Project\Mapping\deploy
cmd /c SetupEnvCmd.cmd

和这里的内容 SetupEnvCmd.cmd

cd C:\develop\jboss-4.2.3.GA\bin
run

我每次运行此,我要浪费时间重新安排和调整的窗口。我不想运行Windows最小化,因为我跟每个窗口多次进行互动,同时编写和测试code。有没有什么办法可以控制从在脚本中打开窗口的位置和/或大小?

Every time I run this, I have to waste time rearranging and resizing the windows. I don't want to run the windows minimized, because I interact with each window many times while writing and testing code. Is there any way I can control the position and/or size of the windows that are opened from within the script?

推荐答案

尝试通过批处理文件启动,从VBS你的程序(Windows脚本宿主)脚本。如果您的VBS看起来是这样的:

Try launching your programs from VBS (Windows Script Host) script via the batch file. If your VBS looks like this:

'FILENAME: SetEnv.vbs
Set Shell = WScript.CreateObject("WScript.Shell")
Shell.Run "Explorer /n,c:\develop\jboss-4.2.3.GA\server\default\deploy", 4, False
Shell.Run "Explorer /n,c:\develop\Project\Mapping\deploy", 4, False

4 表示在其最近的大小/位置启动窗口。 意味着它不会等待执行脚本的下一行之前返回。不幸的是,这不会给你确切的窗口大小/位置的完全控制权,但它应该还记得去年的大小/定位。

The 4 means to launch the window in its most recent size/position. False means it won't wait to return before executing the next line of your script. Unfortunately, this doesn't give you full control of your exact window size/positioning, but it should remember last size/positioning.

更多信息: http://www.devguru.com/Technologies/ WSH / quickref / wshshell_Run.html

所以你的新SetEnv.cmd可能是:

So your new SetEnv.cmd could be:

@echo off
REM note there's a difference between cscript and wscript
REM wscript is usually the default launcher
cscript SetEnv.vbs
cd C:\develop\jboss-4.2.3.GA\bin
run

这篇关于如何可以批处理文件中运行的程序,并设置在窗口的位置和大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆