Start Windows batch file maximized












7















I've written a batch file that I plan on distributing to a few dozen machines. It automatically checks the working state of several devices. I recently added a "menu" at the start of the script, prompting the user to select specific items to query from a list. The list, however, is too long to see without scrolling.



Rather than refining my list, what can I add to the batch to start the Windows shell maximized? I tried to cheat and Right click the .bat -> Properties -> Change the "Run" state to "Maximized", but this option does not exist (and frankly I'd rather add this feature within the script itself).



The machines that are running the script are running Windows 7










share|improve this question



























    7















    I've written a batch file that I plan on distributing to a few dozen machines. It automatically checks the working state of several devices. I recently added a "menu" at the start of the script, prompting the user to select specific items to query from a list. The list, however, is too long to see without scrolling.



    Rather than refining my list, what can I add to the batch to start the Windows shell maximized? I tried to cheat and Right click the .bat -> Properties -> Change the "Run" state to "Maximized", but this option does not exist (and frankly I'd rather add this feature within the script itself).



    The machines that are running the script are running Windows 7










    share|improve this question

























      7












      7








      7


      2






      I've written a batch file that I plan on distributing to a few dozen machines. It automatically checks the working state of several devices. I recently added a "menu" at the start of the script, prompting the user to select specific items to query from a list. The list, however, is too long to see without scrolling.



      Rather than refining my list, what can I add to the batch to start the Windows shell maximized? I tried to cheat and Right click the .bat -> Properties -> Change the "Run" state to "Maximized", but this option does not exist (and frankly I'd rather add this feature within the script itself).



      The machines that are running the script are running Windows 7










      share|improve this question














      I've written a batch file that I plan on distributing to a few dozen machines. It automatically checks the working state of several devices. I recently added a "menu" at the start of the script, prompting the user to select specific items to query from a list. The list, however, is too long to see without scrolling.



      Rather than refining my list, what can I add to the batch to start the Windows shell maximized? I tried to cheat and Right click the .bat -> Properties -> Change the "Run" state to "Maximized", but this option does not exist (and frankly I'd rather add this feature within the script itself).



      The machines that are running the script are running Windows 7







      windows batch cmd.exe






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 18 '13 at 20:06









      rootroot

      2,36751735




      2,36751735






















          3 Answers
          3






          active

          oldest

          votes


















          14














          You can try start /MAX yourscript.bat to start your script in a maximized cmd (up to Windows 7)



          Edit (by Rik):



          I've created a small example which shows how you could do it all in one batch-file

          (without a separate launcher):



          @echo off
          if not "%1" == "max" start /MAX cmd /c %0 max & exit/b

          :: here comes the rest of your batch-file
          echo "test"

          pause


          There will be a slight flicker of the original batch-file (which will exit immediately) before starting the maximized version.





          Simple explanation:

          If the batch is not called with the parameter max we call itself again (%0), this time maximized with the help of start /max, and with the parameter max and that way the second time its called it will skip the if-statement and continue with your commands.



          Breakdown:





          • if not "%1" == "max" execute the next command only if %1 is not "max". %1 stands for the first parameter given to the batch-file. So my_batch.bat max will have max in the %1-variable. If we didn't start the batch with a max parameter we need to execute this line.


          • start /MAX start the command after it, in maximized form.


          • cmd /c execute cmd.exe and /c means exit afterwards.


          • %0 max. The %0 stands for your own batch-file name and here max is its first parameter. This means we need to skip that first if-line or else we get caught in a loop :)


          • & exit/b: The & means execute the next command simultaneous with the previous. This means we executed the start /max your batchfile and in the meantime exit the current batch.


          This also means we can't call this version with any other parameters than max. If your batch-files needs a parameter to start then you'll need to do some more magic (like shifting the %1 after testing).

          If that's the case let us know.






          share|improve this answer


























          • This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

            – root
            Dec 18 '13 at 20:21






          • 1





            @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

            – Rik
            Dec 18 '13 at 20:41













          • @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

            – Rik
            Dec 18 '13 at 21:01













          • @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

            – user2196728
            Dec 18 '13 at 21:07











          • @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

            – Rik
            Dec 18 '13 at 21:08





















          0














          You can maximize the command prompt on during the run but you'll need two additional scripts: windowMode and getCmdPid.bat:



          @echo off

          call getCmdPid
          call windowMode -pid %errorlevel% -mode maximized

          some commands





          share|improve this answer































            -1














            You can try mode.com but that only fullscreens it, it does not position the window:



            @echo off
            mode 1000


            And then enter the code for your batch file.






            share|improve this answer
























            • This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

              – Scott
              Feb 17 at 0:12












            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f690296%2fstart-windows-batch-file-maximized%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            14














            You can try start /MAX yourscript.bat to start your script in a maximized cmd (up to Windows 7)



            Edit (by Rik):



            I've created a small example which shows how you could do it all in one batch-file

            (without a separate launcher):



            @echo off
            if not "%1" == "max" start /MAX cmd /c %0 max & exit/b

            :: here comes the rest of your batch-file
            echo "test"

            pause


            There will be a slight flicker of the original batch-file (which will exit immediately) before starting the maximized version.





            Simple explanation:

            If the batch is not called with the parameter max we call itself again (%0), this time maximized with the help of start /max, and with the parameter max and that way the second time its called it will skip the if-statement and continue with your commands.



            Breakdown:





            • if not "%1" == "max" execute the next command only if %1 is not "max". %1 stands for the first parameter given to the batch-file. So my_batch.bat max will have max in the %1-variable. If we didn't start the batch with a max parameter we need to execute this line.


            • start /MAX start the command after it, in maximized form.


            • cmd /c execute cmd.exe and /c means exit afterwards.


            • %0 max. The %0 stands for your own batch-file name and here max is its first parameter. This means we need to skip that first if-line or else we get caught in a loop :)


            • & exit/b: The & means execute the next command simultaneous with the previous. This means we executed the start /max your batchfile and in the meantime exit the current batch.


            This also means we can't call this version with any other parameters than max. If your batch-files needs a parameter to start then you'll need to do some more magic (like shifting the %1 after testing).

            If that's the case let us know.






            share|improve this answer


























            • This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

              – root
              Dec 18 '13 at 20:21






            • 1





              @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

              – Rik
              Dec 18 '13 at 20:41













            • @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

              – Rik
              Dec 18 '13 at 21:01













            • @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

              – user2196728
              Dec 18 '13 at 21:07











            • @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

              – Rik
              Dec 18 '13 at 21:08


















            14














            You can try start /MAX yourscript.bat to start your script in a maximized cmd (up to Windows 7)



            Edit (by Rik):



            I've created a small example which shows how you could do it all in one batch-file

            (without a separate launcher):



            @echo off
            if not "%1" == "max" start /MAX cmd /c %0 max & exit/b

            :: here comes the rest of your batch-file
            echo "test"

            pause


            There will be a slight flicker of the original batch-file (which will exit immediately) before starting the maximized version.





            Simple explanation:

            If the batch is not called with the parameter max we call itself again (%0), this time maximized with the help of start /max, and with the parameter max and that way the second time its called it will skip the if-statement and continue with your commands.



            Breakdown:





            • if not "%1" == "max" execute the next command only if %1 is not "max". %1 stands for the first parameter given to the batch-file. So my_batch.bat max will have max in the %1-variable. If we didn't start the batch with a max parameter we need to execute this line.


            • start /MAX start the command after it, in maximized form.


            • cmd /c execute cmd.exe and /c means exit afterwards.


            • %0 max. The %0 stands for your own batch-file name and here max is its first parameter. This means we need to skip that first if-line or else we get caught in a loop :)


            • & exit/b: The & means execute the next command simultaneous with the previous. This means we executed the start /max your batchfile and in the meantime exit the current batch.


            This also means we can't call this version with any other parameters than max. If your batch-files needs a parameter to start then you'll need to do some more magic (like shifting the %1 after testing).

            If that's the case let us know.






            share|improve this answer


























            • This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

              – root
              Dec 18 '13 at 20:21






            • 1





              @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

              – Rik
              Dec 18 '13 at 20:41













            • @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

              – Rik
              Dec 18 '13 at 21:01













            • @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

              – user2196728
              Dec 18 '13 at 21:07











            • @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

              – Rik
              Dec 18 '13 at 21:08
















            14












            14








            14







            You can try start /MAX yourscript.bat to start your script in a maximized cmd (up to Windows 7)



            Edit (by Rik):



            I've created a small example which shows how you could do it all in one batch-file

            (without a separate launcher):



            @echo off
            if not "%1" == "max" start /MAX cmd /c %0 max & exit/b

            :: here comes the rest of your batch-file
            echo "test"

            pause


            There will be a slight flicker of the original batch-file (which will exit immediately) before starting the maximized version.





            Simple explanation:

            If the batch is not called with the parameter max we call itself again (%0), this time maximized with the help of start /max, and with the parameter max and that way the second time its called it will skip the if-statement and continue with your commands.



            Breakdown:





            • if not "%1" == "max" execute the next command only if %1 is not "max". %1 stands for the first parameter given to the batch-file. So my_batch.bat max will have max in the %1-variable. If we didn't start the batch with a max parameter we need to execute this line.


            • start /MAX start the command after it, in maximized form.


            • cmd /c execute cmd.exe and /c means exit afterwards.


            • %0 max. The %0 stands for your own batch-file name and here max is its first parameter. This means we need to skip that first if-line or else we get caught in a loop :)


            • & exit/b: The & means execute the next command simultaneous with the previous. This means we executed the start /max your batchfile and in the meantime exit the current batch.


            This also means we can't call this version with any other parameters than max. If your batch-files needs a parameter to start then you'll need to do some more magic (like shifting the %1 after testing).

            If that's the case let us know.






            share|improve this answer















            You can try start /MAX yourscript.bat to start your script in a maximized cmd (up to Windows 7)



            Edit (by Rik):



            I've created a small example which shows how you could do it all in one batch-file

            (without a separate launcher):



            @echo off
            if not "%1" == "max" start /MAX cmd /c %0 max & exit/b

            :: here comes the rest of your batch-file
            echo "test"

            pause


            There will be a slight flicker of the original batch-file (which will exit immediately) before starting the maximized version.





            Simple explanation:

            If the batch is not called with the parameter max we call itself again (%0), this time maximized with the help of start /max, and with the parameter max and that way the second time its called it will skip the if-statement and continue with your commands.



            Breakdown:





            • if not "%1" == "max" execute the next command only if %1 is not "max". %1 stands for the first parameter given to the batch-file. So my_batch.bat max will have max in the %1-variable. If we didn't start the batch with a max parameter we need to execute this line.


            • start /MAX start the command after it, in maximized form.


            • cmd /c execute cmd.exe and /c means exit afterwards.


            • %0 max. The %0 stands for your own batch-file name and here max is its first parameter. This means we need to skip that first if-line or else we get caught in a loop :)


            • & exit/b: The & means execute the next command simultaneous with the previous. This means we executed the start /max your batchfile and in the meantime exit the current batch.


            This also means we can't call this version with any other parameters than max. If your batch-files needs a parameter to start then you'll need to do some more magic (like shifting the %1 after testing).

            If that's the case let us know.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 18 '13 at 21:49









            Rik

            11.2k12134




            11.2k12134










            answered Dec 18 '13 at 20:08









            user2196728user2196728

            1,076710




            1,076710













            • This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

              – root
              Dec 18 '13 at 20:21






            • 1





              @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

              – Rik
              Dec 18 '13 at 20:41













            • @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

              – Rik
              Dec 18 '13 at 21:01













            • @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

              – user2196728
              Dec 18 '13 at 21:07











            • @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

              – Rik
              Dec 18 '13 at 21:08





















            • This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

              – root
              Dec 18 '13 at 20:21






            • 1





              @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

              – Rik
              Dec 18 '13 at 20:41













            • @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

              – Rik
              Dec 18 '13 at 21:01













            • @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

              – user2196728
              Dec 18 '13 at 21:07











            • @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

              – Rik
              Dec 18 '13 at 21:08



















            This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

            – root
            Dec 18 '13 at 20:21





            This will work, but requires creating a "launching" batch. I'm trying to reduce this to the entire operation running solely off of one file - if possible. +1

            – root
            Dec 18 '13 at 20:21




            1




            1





            @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

            – Rik
            Dec 18 '13 at 20:41







            @root you can however create a batch which launches itself with some crafty one-liner at the beginning of the batchfile. Something like @echo off // if not "%1"=="max" start /MAX %0 max // <rest of the batch>>. (not tested, but you can see where i am going...)

            – Rik
            Dec 18 '13 at 20:41















            @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

            – Rik
            Dec 18 '13 at 21:01







            @user2196728 I tool the liberty of adding an example to your answer where you don't need a separate launcher-batch. (hope that's alright)

            – Rik
            Dec 18 '13 at 21:01















            @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

            – user2196728
            Dec 18 '13 at 21:07





            @Rik : no pb as far as what you wrote sounds good to me :) And it sounds right :)

            – user2196728
            Dec 18 '13 at 21:07













            @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

            – Rik
            Dec 18 '13 at 21:08







            @user2196728 No, with echo "rest of batch" i just meant that as a placeholder. After the if not line you can include your normal batch. (i edited it to make it clearer)

            – Rik
            Dec 18 '13 at 21:08















            0














            You can maximize the command prompt on during the run but you'll need two additional scripts: windowMode and getCmdPid.bat:



            @echo off

            call getCmdPid
            call windowMode -pid %errorlevel% -mode maximized

            some commands





            share|improve this answer




























              0














              You can maximize the command prompt on during the run but you'll need two additional scripts: windowMode and getCmdPid.bat:



              @echo off

              call getCmdPid
              call windowMode -pid %errorlevel% -mode maximized

              some commands





              share|improve this answer


























                0












                0








                0







                You can maximize the command prompt on during the run but you'll need two additional scripts: windowMode and getCmdPid.bat:



                @echo off

                call getCmdPid
                call windowMode -pid %errorlevel% -mode maximized

                some commands





                share|improve this answer













                You can maximize the command prompt on during the run but you'll need two additional scripts: windowMode and getCmdPid.bat:



                @echo off

                call getCmdPid
                call windowMode -pid %errorlevel% -mode maximized

                some commands






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 9 '17 at 18:20









                npocmakanpocmaka

                775710




                775710























                    -1














                    You can try mode.com but that only fullscreens it, it does not position the window:



                    @echo off
                    mode 1000


                    And then enter the code for your batch file.






                    share|improve this answer
























                    • This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

                      – Scott
                      Feb 17 at 0:12
















                    -1














                    You can try mode.com but that only fullscreens it, it does not position the window:



                    @echo off
                    mode 1000


                    And then enter the code for your batch file.






                    share|improve this answer
























                    • This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

                      – Scott
                      Feb 17 at 0:12














                    -1












                    -1








                    -1







                    You can try mode.com but that only fullscreens it, it does not position the window:



                    @echo off
                    mode 1000


                    And then enter the code for your batch file.






                    share|improve this answer













                    You can try mode.com but that only fullscreens it, it does not position the window:



                    @echo off
                    mode 1000


                    And then enter the code for your batch file.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 16 at 23:08









                    HayzHayz

                    111




                    111













                    • This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

                      – Scott
                      Feb 17 at 0:12



















                    • This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

                      – Scott
                      Feb 17 at 0:12

















                    This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

                    – Scott
                    Feb 17 at 0:12





                    This seems not to fullscreen the window, but just to make it very big, while leaving the upper-left corner where it was.

                    – Scott
                    Feb 17 at 0:12


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f690296%2fstart-windows-batch-file-maximized%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido