Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post

    How to Maximize Window from Batch file that Opened the Window

    I am using the AutoExec.bat file to start the desired program in WinXP running in Virtualbox. (The program will not install in Win8.) That part is working fine but I would like the program's to open in a maximized window. Can anyone think of a way to accomplish that?

    Thanks,
    Bill

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Bill,

    Rather than using AutoExec.bat I created a shortcut to a program (Revo Uninstaller Free). In the shortcut's properties I set it to start Maximized (Run: box) and saved. Then I placed the short cut in the Startup ("C:\Documents and Settings\USERID\Start Menu\Programs\Startup") Folder. Rebooted and Revo started right up maximized.

    HTH
    VBAutoStart.JPG
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,421
    Thanks
    33
    Thanked 195 Times in 175 Posts
    It may be possible to use the Command Prompt START command. Have a look at START /?
    Because of a minor bug, it is usually best to specify a title, even a null one, as in
    START "" /MAX <programname>
    BATcher

    Time prevents everything happening all at once...

  4. #4
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    OK, the first thing I tried was RG's suggestion to put a shortcut in the startup folder and that has not worked! The same shortcut on the virtual WinXP desktop works fine. So, this morning I tried using the Start command suggested by BATcher. It also doesn't work in the AutoExec.bat file but it works fine when typed into the CMD window!

    This little effort has one complication: I want this program to start in a specific host folder so that it will use the real data files that are being backed up properly. That host folder has been assigned the drive letter F. In the case of the shortcut, I could use the Start In parameter to accomplish this. It did not like my specifying the string that identifies that host folder but when I switched to using F: it worked OK when manually initiated. In the case of using the Startup folder, I have used the F: designation in the shortcut in that folder.

    Maybe the need to run in a host folder is causing a problem, although it works fine that way when starting in Normal window mode. Later today I will look into letting it use the files in the virtual folder and then copying them into the backed up folder during VB shutdown. I'll let you know the results when I get them.

    Thanks for helping.
    Bill

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Bill,

    Could you post a screen shot of your virtual machine and the shortcut properties like I did in my post?

    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. #6
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    OK, here is the screenshot of the shortcut in the startup folder in WinXP in the VirtualBox.
    Attached Images Attached Images

  7. #7
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Bill,

    The only thing that I see that could possibly be a problem is that your F: is a mapped drive and may not be mapped when the program attempts to start. Try putting the URL directly in the Startin box and see if that helps. You could check your log files and see if anything is noted there also.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  8. #8
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    Actually, I used the URL to start with and was told on the first try that it could not be used in a batch file, or something to that effect. That may be the problem. In my earliest attempts at this I was using DOS commands in the AutoExec.bat file and they worked every time but the program window was not maximized. Actually, I was using the F: drive letter back then too but it seemed to be working reliably. Do you know if the Startup folder contents is executed before the AutoExec file?

    Can you tell me how to find the log files you referred to?

    Thanks,
    Bill

  9. #9
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Quote Originally Posted by BillWilson View Post
    Do you know if the Startup folder contents is executed before the AutoExec file?
    Sorry Bill I don't.

    Quote Originally Posted by BillWilson View Post
    Can you tell me how to find the log files you referred to?
    Just start up the EventViewer.

    HTH

    Thanks,
    Bill[/QUOTE]
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  10. #10
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    I have reviewed the items in the event viewer dated today pretty thoroughly and I don't see anything that seems to be connected to what I was doing with the VB.

    I'm going to try one more thing. I'll go back to the AutoExec file approach and build in a delay ahead of the attempt to start the program.

    Thanks for helping.
    Bill

  11. #11
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Bill,

    Did you check the EventViewer in the VM?
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  12. #12
    Silver Lounger wavy's Avatar
    Join Date
    Dec 2009
    Location
    ny
    Posts
    2,383
    Thanks
    235
    Thanked 147 Times in 136 Posts

    Fyi re autoexec.bat

    Quote Originally Posted by BillWilson View Post
    It also doesn't work in the AutoExec.bat file but it works fine when typed into the CMD window!

    l
    Windows NT and its descendants Windows XP and Windows Vista parse AUTOEXEC.BAT when a user logs on. As with Windows Me, anything other than setting environment variables is ignored
    On Windows NT and its derivatives, Windows 2000, Windows Server 2003 and Windows XP, the equivalent file is called AUTOEXEC.NT and is located in the %SystemRoot%\system32 directory. The file is not used during the operating system boot process; it is executed when the MS-DOS environment is started, which occurs when an MS-DOS application is loaded.
    https://en.wikipedia.org/wiki/Autoexec
    David

    Just because you don't know where you are going doesn't mean any road will get you there.

  13. #13
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by RetiredGeek View Post
    Bill,

    Did you check the EventViewer in the VM?
    That's a really good point! I hadn't thought of that. So, I did check the event viewer in the VM last night and didn't find any suspicious looking entries.

    The next post in this thread looks promising; I'll look into it.

    Thanks,
    Bill

  14. #14
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    wavy, thanks for the info on AutoExec.bat vs AutoExec.NT! I tried moving my 2-line command below to AutoExec.NT and that didn't help!
    ------
    F:
    Start "" /MAX "C:\Program Files\Info Select\is.exe"
    ------
    I double checked my Start command by opening a CMD window and typing it in there and it works fine when executed in that environment. So, it seems likely, as RG said earlier, that the F: drive letter assignment isn't getting set up before the AutoExec file is executed.

    I just tried adding an ASSIGN command to the AutoExec.NT file to assign a drive letter to the URL for the program data folder. That didn't help during a reboot so then I entered the ASSIGN command in a CMD window and it said that ASSIGN was not a recognized command! So I guess I'm stuck again!

    Thanks for the info.
    Bill

  15. #15
    Silver Lounger wavy's Avatar
    Join Date
    Dec 2009
    Location
    ny
    Posts
    2,383
    Thanks
    235
    Thanked 147 Times in 136 Posts
    Just a wild guess, but assuming the F: drive is not getting recognized early enough how about a dir F: placed before the is.exe??

    David

    Just because you don't know where you are going doesn't mean any road will get you there.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •