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.

link|improve this question
feedback

1 Answer

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.

link|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
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.