Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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