Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to start several cmd.exe console applications so that they should be positioned on the screen in a particular order - is it possible to do with a .bat file?

I am running Windows 7.

share|improve this question
up vote 2 down vote accepted

I'm not aware of a way to do it with a batch script, but you can use the following VBScript:

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objConfig = objWMIService.Get("Win32_ProcessStartup")

objConfig.SpawnInstance_
objConfig.X = 100
objConfig.Y = 100

Set objNewProcess = objWMIService.Get("Win32_Process")

intReturn = objNewProcess.Create("cmd.exe", Null, objConfig, intProcessID)

It uses the Win32_ProcessStartup WMI class - you can find more details here.

Change the value of objConfig.X and objConfig.Y to set the X and Y location of where the Command Prompt should open.

share|improve this answer
    
You can also accomplish this with AutoIt, but vbscript might be simpler for this particular task. – MaQleod Aug 22 '11 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .