3

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.

1 Answer 1

4

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.

1
  • You can also accomplish this with AutoIt, but vbscript might be simpler for this particular task.
    – MaQleod
    Aug 22, 2011 at 7:33

You must log in to answer this question.

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