?
Solved

batch file to force program window locations and sizes?

Posted on 2004-04-22
9
Medium Priority
?
1,218 Views
Last Modified: 2008-02-01
I have a batch file that opens up 6 putty ssh sessions automatically.  I would like to be able to specify the exact location and size of each and every putty window on my desktop upon execution of the batch file.  I can do this in Unix X-Windows using special parameters to the "xterm" command, but have had no luck figuring it out in Windows XP either through batch commands or putty session settings.
0
Comment
Question by:skeed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 10888151
Without coding this in another programming language, I don't think you'll get what you're after.
The closest I think you could get, though not automated, would be to right-click your task bar and click Tile Windows vertically/horizontally...

One other method I can think of..
Go to %systemroot%\system32 folder
Duplicate the cmd.exe file 6 times (one for each instance of the bat file).
cmd1.exe, cmd2.exe, etc

Now click start/run/cmd1.exe
Move the window to where you want the first bat file to appear
Click the menu bar (where it looks like a small C:\ prompt window - upper left corner) and choose properties.
From the layout tab, deselect "Let system position window".  Click Ok - you'll be asked to apply the settings to current window only or save for future sessions (choose the latter obviously).  Now repeat these procedures to the other 5 cmd sessions.

Now, when you run your bat file, precede the call line with the appropriate command session (cmd1.exe mybat1.bat)
0
 
LVL 17

Expert Comment

by:Eagle6990
ID: 10889137
I don't know exactly what layout you want, but once all 6 windows are opened, you can right click on an open area of the taskbar, or if the programs group together, you can right click on the group, and select tile horizontally or vertically to auto-position then on the screen.  I use this when opening pinging windows to all our routers.  Lets me see all the screens at once.
0
 

Author Comment

by:skeed
ID: 10909827
Sirbounty,

Thanks for your suggestions.  However, when I precede either the batch file or the commands within the batch file with "cmd1.exe", it merely loads the command prompt and not my batch file or specifically putty.exe.  Am I doing something wrong?  Thanks.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 67

Expert Comment

by:sirbounty
ID: 10909936
You'll need to create a shortcut to putty.exe for each one.  Then edit the shortcut to precede it with CMD1 {path to putty}\putty.exe
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 10909938
You can also right-click the desktop/new shortcut and navigate to it.
Then right-click the shortcut and choose properties to edit it as above...you'll need to repeat this for each instance, obviously.
Don't hesitate to ask if you need further clarification... :D
0
 

Author Comment

by:skeed
ID: 10912466
Sirbounty,

I have created the shortcut with the Target defined as:

C:\WINDOWS\system32\cmdtest1.exe C:\putty\putty.exe

and upon double clicking on it, it still merely loads the dos command line.

Am I doing something wrong?  Thanks.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 10914567
I think I misread your prior post - place cmd1.exe in front of your calling batch file...
You might even try this way CMD1 /K myfile.bat
0
 

Author Comment

by:skeed
ID: 10948276
Sirbounty,

I am able to get it to do what I want using the CMD1 /C command, for the most part.  For some reason, the windows don't appear in the exact same location that I had set for them, but they are spaced apart in the appropriate manner, which is the main thing I was going for.  

On a side note, do you know what the equivalent of the Unix "sleep" command is in Windows batch programming?  

I'm going to give you all the points I can for helping me on this.  Thanks immensely for your time and advice.
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 10953845
Well, there's a SLEEP command in the windows environment as well - although it may be part of the resource kit.
Another trick some people use is a
Ping -N # 127.0.0.1 > nul
Replace # with the number of times you want it to ping (it's not 'exactly' a second per ping, but it's close)...

I did find the RKTools for Windows 2003 - sleep.exe should work for you from this package...
http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question