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











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.







      windows command-line






      share|improve this question













      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




















                protected by Community Dec 3 at 19:32



                Thank you for your interest in this question.
                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                Would you like to answer one of these unanswered questions instead?














                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

                    2,2593824




                    2,2593824
























                        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

                        250k11258556




                        250k11258556












                        • 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

                            13.9k31938




                            13.9k31938






















                                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

                                    1,030137




                                    1,030137

















                                        protected by Community Dec 3 at 19:32



                                        Thank you for your interest in this question.
                                        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                        Would you like to answer one of these unanswered questions instead?



                                        Popular posts from this blog

                                        If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                                        Alcedinidae

                                        Can an atomic nucleus contain both particles and antiparticles? [duplicate]