0

I'm trying to automate the launch of many applications at once with some customization. I am aware of Batch and Powershell, the fact that they can launch applications, and have done some minor programming with them both before (although it's been awhile).

Ideally, I would like to launch certain applications such as multiple Chrome windows, OBS, VLC... Once the applications are launched, I would like them to appear in a defined location on my screen, as well as adjusted to a pre-defined window size.

I've been able to launch the applications with basic batch but i'm not sure where to go or look to do the custom sizing and location.

Can I accomplish this with simple batch, or will I need powershell or some sort of third party application?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
  • Adding `/min` or `/max` to a Start command will allow you to minimize or maximize the app. Beyond that, you're going to need something stronger than batch. See also http://stackoverflow.com/questions/10392620/how-can-a-batch-file-run-a-program-and-set-the-position-and-size-of-the-window – Robert Harvey Dec 15 '14 at 21:30
  • Thanks for your reply Robert. I figured I would need something like powershell, i'm just not sure if there may be something existing that I could use, or if I would have to write it out manually. Also, the link you provided doesn't tackle my issue of window position and size. "Unfortunately, this doesn't give you full control of your exact window size/positioning, but it should remember last size/positioning." – user3727305 Dec 15 '14 at 23:26
  • I recently had a similar situation where I had to open 15 windows and resize and move them to exact locations. I ended up having to use PowerShell that called the MoveWindow function of the Win32 API. – SomethingDark Dec 16 '14 at 08:54

2 Answers2

1

I'd suggest using AutoHotKey, which would easily handle this (better than Powershell and Batch, in this case).

As a simple sample, to launch a single instance of a given application (Chrome) and resize (and move) it, you might do something like this:

Run chrome.exe http://examplesite.com
WinMove, Site Title - Google Chrome, 0, 0, 200, 200

WinMove Help Doc

Please note that I'm very lazily assuming that Chrome is on Path here. It's almost certainly not, but depending on which installer you use it'll either be in AppData or Program Files.

James Ruskin
  • 808
  • 7
  • 13
0

Batch cannot do this alone. API calls can (and I suspect powershell can, but ONLY when starting a program - see .NET Process Builder). As a general rule programs shouldn't play with other programs. Windows functions are in the API only and shouldn't be used NORMALLY for other PROCESS'S windows.

I have a collection of 2 or 3 line VB6 programs to size/move/hide/unhide/ontop/not ontop/change titlebartext of running programs. Using SetWindowPos and SetText.

It's meant to be used by batch files.

Source code is provided.

It's split across three folders.

Show-Hide Window, Topmost, and Topmost_src

https://onedrive.live.com/redir?resid=E2F0CE17A268A4FA!121&authkey=!AAFg7j814-lJtmI&ithint=folder%2cres