How to open a .exe file using an abbreviation in CMD

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I want to start an .EXE file using one command, an abbreviation or alias you could say.
For example, I want to open Far Manager using an alias, I have at first to CD into the path, which is c:UsersmyUserdesktopfarfar.exe.
I know about the set "alias=myCommand param1 param2" but the problem is I want a single command to open up the application, for example Atom and VSCode have this feature, if I type atom or code in cmd it will open up. so I want to set a single command to open up the application without having to changing the directory into it at first and then use the start command.







share|improve this question
























    up vote
    1
    down vote

    favorite












    I want to start an .EXE file using one command, an abbreviation or alias you could say.
    For example, I want to open Far Manager using an alias, I have at first to CD into the path, which is c:UsersmyUserdesktopfarfar.exe.
    I know about the set "alias=myCommand param1 param2" but the problem is I want a single command to open up the application, for example Atom and VSCode have this feature, if I type atom or code in cmd it will open up. so I want to set a single command to open up the application without having to changing the directory into it at first and then use the start command.







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I want to start an .EXE file using one command, an abbreviation or alias you could say.
      For example, I want to open Far Manager using an alias, I have at first to CD into the path, which is c:UsersmyUserdesktopfarfar.exe.
      I know about the set "alias=myCommand param1 param2" but the problem is I want a single command to open up the application, for example Atom and VSCode have this feature, if I type atom or code in cmd it will open up. so I want to set a single command to open up the application without having to changing the directory into it at first and then use the start command.







      share|improve this question












      I want to start an .EXE file using one command, an abbreviation or alias you could say.
      For example, I want to open Far Manager using an alias, I have at first to CD into the path, which is c:UsersmyUserdesktopfarfar.exe.
      I know about the set "alias=myCommand param1 param2" but the problem is I want a single command to open up the application, for example Atom and VSCode have this feature, if I type atom or code in cmd it will open up. so I want to set a single command to open up the application without having to changing the directory into it at first and then use the start command.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 29 at 18:21









      Mahmoud Abd-El Ghany

      82




      82




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          One way to do this is to add the folder path for the executable to your PATH environment variable.



          In Windows 7, 8 and 10, you can:



          1. Open the Start menu

          2. Type "environment variables"

          3. Click "Edit the system environment variables"

          4. Click the Environment Variables button

          5. In the System variables section, select the Path variable and click the Edit button.

          Alternatively (also for older versions of Windows):



          1. Right click "Computer", "This Computer" or "This PC" on your desktop.

          2. Click Properties

          3. Click the Advanced Tab

          4. Click the Environment Variables button

          5. In the System variables section, select the Path variable and click the Edit button.

          In Windows 10 (and possibly 8?), you will see an edit window that makes it easy to add a path. In prior editions of Windows, you will see a text box edit window. Add the folder path to the end, preceded by a semi-colon: ;c:UsersmyUserdesktopfarfar.exe



          enter image description here






          share|improve this answer



























            up vote
            2
            down vote













            The simplest solution would be to put your code into a .bat file,
            then add its folder into the PATH environment variable (or store the file into
            a folder that is already in the PATH).



            To avoid seeing the commands execute, start the file with an @echo off line.






            share|improve this answer




















            • This would definitely be my approach too.
              – LPChip
              Aug 29 at 18:50

















            up vote
            2
            down vote













            One more option is to use doskey, which gives a macro function in cmd:-



            doskey MacroName=pushd c:UsersmyUserdesktopfar $T start far.exe $ popd


            You can add this command to a cmd start-up file.



            Yet another option is to set the directory and program name in a program shortcut (eg far.lnk) which you can create in a directory already in your path. Such files can be called direct from cmd.






            share|improve this answer



























              up vote
              1
              down vote













              If you want to be able to start a command without having to specify the full path, you have to include the directory in your PATH variable. You can see the current PATH with



              echo %PATH%





              share|improve this answer




















                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',
                convertImagesToLinks: true,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                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%2f1353519%2fhow-to-open-a-exe-file-using-an-abbreviation-in-cmd%23new-answer', 'question_page');

                );

                Post as a guest






























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                2
                down vote



                accepted










                One way to do this is to add the folder path for the executable to your PATH environment variable.



                In Windows 7, 8 and 10, you can:



                1. Open the Start menu

                2. Type "environment variables"

                3. Click "Edit the system environment variables"

                4. Click the Environment Variables button

                5. In the System variables section, select the Path variable and click the Edit button.

                Alternatively (also for older versions of Windows):



                1. Right click "Computer", "This Computer" or "This PC" on your desktop.

                2. Click Properties

                3. Click the Advanced Tab

                4. Click the Environment Variables button

                5. In the System variables section, select the Path variable and click the Edit button.

                In Windows 10 (and possibly 8?), you will see an edit window that makes it easy to add a path. In prior editions of Windows, you will see a text box edit window. Add the folder path to the end, preceded by a semi-colon: ;c:UsersmyUserdesktopfarfar.exe



                enter image description here






                share|improve this answer
























                  up vote
                  2
                  down vote



                  accepted










                  One way to do this is to add the folder path for the executable to your PATH environment variable.



                  In Windows 7, 8 and 10, you can:



                  1. Open the Start menu

                  2. Type "environment variables"

                  3. Click "Edit the system environment variables"

                  4. Click the Environment Variables button

                  5. In the System variables section, select the Path variable and click the Edit button.

                  Alternatively (also for older versions of Windows):



                  1. Right click "Computer", "This Computer" or "This PC" on your desktop.

                  2. Click Properties

                  3. Click the Advanced Tab

                  4. Click the Environment Variables button

                  5. In the System variables section, select the Path variable and click the Edit button.

                  In Windows 10 (and possibly 8?), you will see an edit window that makes it easy to add a path. In prior editions of Windows, you will see a text box edit window. Add the folder path to the end, preceded by a semi-colon: ;c:UsersmyUserdesktopfarfar.exe



                  enter image description here






                  share|improve this answer






















                    up vote
                    2
                    down vote



                    accepted







                    up vote
                    2
                    down vote



                    accepted






                    One way to do this is to add the folder path for the executable to your PATH environment variable.



                    In Windows 7, 8 and 10, you can:



                    1. Open the Start menu

                    2. Type "environment variables"

                    3. Click "Edit the system environment variables"

                    4. Click the Environment Variables button

                    5. In the System variables section, select the Path variable and click the Edit button.

                    Alternatively (also for older versions of Windows):



                    1. Right click "Computer", "This Computer" or "This PC" on your desktop.

                    2. Click Properties

                    3. Click the Advanced Tab

                    4. Click the Environment Variables button

                    5. In the System variables section, select the Path variable and click the Edit button.

                    In Windows 10 (and possibly 8?), you will see an edit window that makes it easy to add a path. In prior editions of Windows, you will see a text box edit window. Add the folder path to the end, preceded by a semi-colon: ;c:UsersmyUserdesktopfarfar.exe



                    enter image description here






                    share|improve this answer












                    One way to do this is to add the folder path for the executable to your PATH environment variable.



                    In Windows 7, 8 and 10, you can:



                    1. Open the Start menu

                    2. Type "environment variables"

                    3. Click "Edit the system environment variables"

                    4. Click the Environment Variables button

                    5. In the System variables section, select the Path variable and click the Edit button.

                    Alternatively (also for older versions of Windows):



                    1. Right click "Computer", "This Computer" or "This PC" on your desktop.

                    2. Click Properties

                    3. Click the Advanced Tab

                    4. Click the Environment Variables button

                    5. In the System variables section, select the Path variable and click the Edit button.

                    In Windows 10 (and possibly 8?), you will see an edit window that makes it easy to add a path. In prior editions of Windows, you will see a text box edit window. Add the folder path to the end, preceded by a semi-colon: ;c:UsersmyUserdesktopfarfar.exe



                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 29 at 18:39









                    Worthwelle

                    686114




                    686114






















                        up vote
                        2
                        down vote













                        The simplest solution would be to put your code into a .bat file,
                        then add its folder into the PATH environment variable (or store the file into
                        a folder that is already in the PATH).



                        To avoid seeing the commands execute, start the file with an @echo off line.






                        share|improve this answer




















                        • This would definitely be my approach too.
                          – LPChip
                          Aug 29 at 18:50














                        up vote
                        2
                        down vote













                        The simplest solution would be to put your code into a .bat file,
                        then add its folder into the PATH environment variable (or store the file into
                        a folder that is already in the PATH).



                        To avoid seeing the commands execute, start the file with an @echo off line.






                        share|improve this answer




















                        • This would definitely be my approach too.
                          – LPChip
                          Aug 29 at 18:50












                        up vote
                        2
                        down vote










                        up vote
                        2
                        down vote









                        The simplest solution would be to put your code into a .bat file,
                        then add its folder into the PATH environment variable (or store the file into
                        a folder that is already in the PATH).



                        To avoid seeing the commands execute, start the file with an @echo off line.






                        share|improve this answer












                        The simplest solution would be to put your code into a .bat file,
                        then add its folder into the PATH environment variable (or store the file into
                        a folder that is already in the PATH).



                        To avoid seeing the commands execute, start the file with an @echo off line.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Aug 29 at 18:39









                        harrymc

                        236k9243521




                        236k9243521











                        • This would definitely be my approach too.
                          – LPChip
                          Aug 29 at 18:50
















                        • This would definitely be my approach too.
                          – LPChip
                          Aug 29 at 18:50















                        This would definitely be my approach too.
                        – LPChip
                        Aug 29 at 18:50




                        This would definitely be my approach too.
                        – LPChip
                        Aug 29 at 18:50










                        up vote
                        2
                        down vote













                        One more option is to use doskey, which gives a macro function in cmd:-



                        doskey MacroName=pushd c:UsersmyUserdesktopfar $T start far.exe $ popd


                        You can add this command to a cmd start-up file.



                        Yet another option is to set the directory and program name in a program shortcut (eg far.lnk) which you can create in a directory already in your path. Such files can be called direct from cmd.






                        share|improve this answer
























                          up vote
                          2
                          down vote













                          One more option is to use doskey, which gives a macro function in cmd:-



                          doskey MacroName=pushd c:UsersmyUserdesktopfar $T start far.exe $ popd


                          You can add this command to a cmd start-up file.



                          Yet another option is to set the directory and program name in a program shortcut (eg far.lnk) which you can create in a directory already in your path. Such files can be called direct from cmd.






                          share|improve this answer






















                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote









                            One more option is to use doskey, which gives a macro function in cmd:-



                            doskey MacroName=pushd c:UsersmyUserdesktopfar $T start far.exe $ popd


                            You can add this command to a cmd start-up file.



                            Yet another option is to set the directory and program name in a program shortcut (eg far.lnk) which you can create in a directory already in your path. Such files can be called direct from cmd.






                            share|improve this answer












                            One more option is to use doskey, which gives a macro function in cmd:-



                            doskey MacroName=pushd c:UsersmyUserdesktopfar $T start far.exe $ popd


                            You can add this command to a cmd start-up file.



                            Yet another option is to set the directory and program name in a program shortcut (eg far.lnk) which you can create in a directory already in your path. Such files can be called direct from cmd.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 29 at 19:08









                            AFH

                            12.6k31735




                            12.6k31735




















                                up vote
                                1
                                down vote













                                If you want to be able to start a command without having to specify the full path, you have to include the directory in your PATH variable. You can see the current PATH with



                                echo %PATH%





                                share|improve this answer
























                                  up vote
                                  1
                                  down vote













                                  If you want to be able to start a command without having to specify the full path, you have to include the directory in your PATH variable. You can see the current PATH with



                                  echo %PATH%





                                  share|improve this answer






















                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote









                                    If you want to be able to start a command without having to specify the full path, you have to include the directory in your PATH variable. You can see the current PATH with



                                    echo %PATH%





                                    share|improve this answer












                                    If you want to be able to start a command without having to specify the full path, you have to include the directory in your PATH variable. You can see the current PATH with



                                    echo %PATH%






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 29 at 18:26









                                    RalfFriedl

                                    6737




                                    6737



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1353519%2fhow-to-open-a-exe-file-using-an-abbreviation-in-cmd%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                        Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                                        Confectionery