How Can I Specify what Screen to Open an Application on?

I am running Windows 7 on a system with 4 monitors.  On login I currently have a batch file running using the Start command to fire up the application multiple times and open different files.  That part is working without issues but the problem I have is all the different sessions of the application open on the same screen/monitor.  I then have to move the files around to the screen I want them on.  I am wondering if there is a way by script (batch file, VBscript,etc) to open the application, specify what file to open, and finally which of the 4 monitors to open it on.  Below is a basic sample of the Start command I am using in my Batch file.

start "Screen1" /MAX /d "C:\Program Files\My Program" MyProgram.exe "\\mydomain\c$\MyFile"
Who is Participating?
Steve KnightIT ConsultancyCommented:
Well there are API ways but I don't know of a commandline tool to do it.  Other option is something like AutoIt.  That is free and great at such things and use it for various production line processes to read colours from the screen and the like.  Have been using it for MANY years though it has been through a few versions of the language.


will move the window titled "Mail" at the start of it to position 100,100 on the main monitor and make it 500 x 400 pixels.  You install auto-it, write this into their editor, or just notepad as whatever.au3, double click and run, or right click and compile into an exe.

You don't have to have autoit on this machine if you compile it elsewhere.

I have only used it with monitors to the right of the main one but afaik it is fairly logical with x being <0 for monitors to the left of the start button and x > 0 for those to the right.

You can soon have it start the apps too:

Run("C:\Program Files\My Program\MyProgram.exe \\mydomain\c$\MyFile")

Run("C:\Program Files\My Program\MyProgram.exe \\mydomain\c$\MyFile2")

Is that do-able?  It can do so much more but useful for simple scripts like this too.

Steve KnightIT ConsultancyCommented:
I don't know off hand.... and only got one screen at the mo. to check but I believe a shortcut that remembers where it was launched last time will show on the same monitor as the system sees it as one big screen X x Y pixels.

So if you create four shorcuts to your apps, or a batch file, or your one batch file with a parameter etc. that launch one screen each.  Open the command window, right click in the corner and the properties of that batch file and in the Layout tab turn off the "let the system position the window for me" tickbox.  The adjust the position of the window to where you want it and close it (you could do this on the shortcut instead without it open).

If this DOES work for you too then you should be able to launch the shortcut, which will be a .LNK file of whatever you name it, e.g.

START "System 1" "c:\myapp\screen1.lnk"
START "System 1" "%userprofile%\desktop\screen1.lnk"


rknealAuthor Commented:
Thanks for your reply.  I gave what you suggested a shot but it doesnt work for me.  Changing the paramaters on the Layout tab only seems to change where the command window is opened when the batch file is executed.  I also couldnt see any way to edit the Layout for a .LNK shortcut file.  It just keep defaulting to the last screen that i had the application loaded on.  Since I am trying to launch the same application 4 times, just with 4 different files, it opens on what Windows identified as the last screen it was open.

Any other ideas? Thanks.
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Steve KnightIT ConsultancyCommented:
Ahh Ok, sorry I thought these were command window applications, understood.

I will try when I have a dual monitor hooked later as I have a few ideas of what may work.

Aside from that I believe it is down to the app where it places it's window when it starts, i.e. it could choose to store its location, or not...

What sort of files are these -- if the application is programmable, i.e. VBA in word, excel etc. then it might be do-able by opening them from that.

rknealAuthor Commented:
The program is called ProcessBook from OSISoft.  It is a graphics viewing tools for Process Control.  You probably won't have access to download it since it is licensed software but I would think if we could get this to work in another application then it should work in my application.i was lookign at programs liek UltraMon and DisplayFusion but I would rather not have to buy and depend on a third party software if I can do what i want with a simple script.
rknealAuthor Commented:
Ok well I think I found where app is storing its location.  There is an INI that contains the following section with the location info.


The WindowPos is what i need to modify.  Do you you know if there is a way in a batch file to parse the .INI file and when it sees the line with WindowPos it will replace it with a different line?
Steve KnightIT ConsultancyCommented:
Certainly.  Is there much else in this file then?

Easiest way well be to keep multiple files if they are basically static, i.e something like:

copy /y screen1.ini yourfile.ini
start "Screen1" "C:\yourapp....."

copy /y screen2.ini yourfile.ini

Or we can read the file a line at a time and replace that line... or use util to do that.

Another easier way is to arrange it so that the [Startup] Section is at the bottom of the INI file, then:

copy /y yourini.ini yourini.old
find /v "WindowPos=" < yourini.old > yourini.ini
echo WindowPos=2,3,-1,-1,-1,-1,23,166,983,884 >>yourini.ini

That takes a copy of the INI file to .OLD, uses find to make a file called yourini.ini excluding the WindowPos line
then adds the line to the end of the file and removes the temp file

It may also be worth checking to see if there is a commandline option to point it at a different INI file, some apps that use ini do.

rknealAuthor Commented:
Solution was mostly what i needed and got me thinking about how to come to my final solution.
Steve KnightIT ConsultancyCommented:
Sorry I couldn't come with anything more specific.  Did you get this working by editing those INI files in the end then?

Temp NameCommented:
Could you post your final solution you are talking about?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.