Adding an .exe to default path without adding the directoryHow use windows command-line to run tools like SVN...

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

How would 10 generations of living underground change the human body?

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

How to display Aura JS Errors Lightning Out

Like totally amazing interchangeable sister outfits II: The Revenge

How to prevent z-fighting in OpenSCAD?

Apply MapThread to all but one variable

a sore throat vs a strep throat vs strep throat

How do I reattach a shelf to the wall when it ripped out of the wall?

What is the philosophical significance of speech acts/implicature?

Overlay of two functions leaves gaps

Is there any official lore on the Far Realm?

What makes accurate emulation of old systems a difficult task?

Function pointer with named arguments?

Implications of cigar-shaped bodies having rings?

Minor Revision with suggestion of an alternative proof by reviewer

What does the integral of a function times a function of a random variable represent, conceptually?

How to fry ground beef so it is well-browned

Why do games have consumables?

Map of water taps to fill bottles

Can SQL Server create collisions in system generated constraint names?

Can I grease a crank spindle/bracket without disassembling the crank set?

On The Origin of Dissonant Chords



Adding an .exe to default path without adding the directory


How use windows command-line to run tools like SVN and MYSQL without going to theirs respective pathAbbreviate exe name in Windows PATHUbuntu: Reset $PATH to factory defaultWindows command prompt seemingly ignoring PATHStart bash shell (cygwin) with correct path without changing directoryModifying the Path environment variable is not workingAccess/modify the user Path variable, not system PathDoes the order of the directories listed in the Windows PATH variable affect system performance in any meaningful way?Can I use shortcuts from a directory in PATH?Running executables through Windows CMD without specifying entire pathAdd a new path to PATH but end up with editing the last existing path in PATHDoes the Windows Command Prompt search somewhere other than those locations specified by the PATH variable when launching application programs?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







22















For example, I want to add notepad++ to my PATH, however the directory also contains uninstall.exe and several other files/executables and I don't want them to "pollute" my path. Can I just add the one notepad++.exe?










share|improve this question































    22















    For example, I want to add notepad++ to my PATH, however the directory also contains uninstall.exe and several other files/executables and I don't want them to "pollute" my path. Can I just add the one notepad++.exe?










    share|improve this question



























      22












      22








      22


      9






      For example, I want to add notepad++ to my PATH, however the directory also contains uninstall.exe and several other files/executables and I don't want them to "pollute" my path. Can I just add the one notepad++.exe?










      share|improve this question
















      For example, I want to add notepad++ to my PATH, however the directory also contains uninstall.exe and several other files/executables and I don't want them to "pollute" my path. Can I just add the one notepad++.exe?







      windows path environment-variables






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 '11 at 2:05







      Louis Rhys

















      asked Jan 3 '11 at 14:53









      Louis RhysLouis Rhys

      72851426




      72851426






















          6 Answers
          6






          active

          oldest

          votes


















          17














          You can add a batch script to a directory that is in your path, that looks something like this:



          @echo off

          :: Notepad++ execution

          if [%1]==[-h] goto :HELP
          if [%1]==[--help] goto :HELP
          if [%1]==[/?] goto :HELP
          goto :START

          :START
          start "" /i "%ProgramFiles(x86)%notepad++notepad++.exe" %*
          goto :EOF

          :HELP
          echo -------------------------------
          echo Notepad++ Command Argument Help
          echo -------------------------------
          echo Usage :
          echo.
          echo notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]
          echo.
          echo --help : This help message
          echo -multiInst : Launch another Notepad++ instance
          echo -noPlugins : Launch Notepad++ without loading any plugin
          echo -l : Launch Notepad++ by applying indicated language to the file to open
          echo -n : Launch Notepad++ by scrolling indicated line on the file to open
          echo -c : Launch Notepad++ on scrolling indicated column on the file to open
          echo -x : Launch Notepad++ by indicating its left side position on the screen
          echo -y : Launch Notepad++ by indicating its top position on the screen
          echo -nosession : Launch Notepad++ without any session
          echo -notabbar : Launch Notepad++ without tabbar
          echo -ro : Launch Notepad++ and make the file to open read only
          echo -systemtray : Launch Notepad++ directly in system tray
          echo -loadingTime : Display Notepad++ loading time
          echo -alwaysOnTop : Make Notepad++ always on top
          echo fullFilePathName : file name to open (absolute or relative path name)
          echo.
          goto :EOF

          :EOF


          You can name it notepad++.cmd. The help section allows you to easily get information on the switches.



          I put all such scripts and command line programs in a directory which is added to %PATH%:
          C:UsersPublicCommand
          ...and that directory is synced to all computers and virtual machines.






          share|improve this answer

































            8














            Create a batch file with contents like the following:



            @"C:Program FilesGitbingit.exe" %*


            This should be saved as a .bat file, such as git.bat in a directory that's in your PATH.



            @ suppresses echoing the command to the invoking shell. The quotations "" prevent white space being interpreted as argument delimiters. %* pastes any arguments to the batch file, to the quoted executable instead.



            You can now invoke the executable using the part of the batch file name before .bat. In my case, git.



            References:




            • Adding Python to Windows path using a small batch file

            • Adding Python to Windows path using a small batch file - forum thread






            share|improve this answer
























            • For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

              – paradroid
              Jul 3 '12 at 19:15













            • @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

              – Matt Joiner
              Jul 3 '12 at 20:46





















            3














            Drag a shortcut to notepad++.exe to C:WindowsSystem32.





            Alternatively, as suggested by @Synetech inc., you could place your shortcuts in a separate directory (e.g. C:Shortcuts), and then add that directory to %PATH%:



            setx PATH "%PATH%;C:Shortcuts"




            As some of the comments indicate, this only works from the Run dialog. In order to get the shortcuts to launch from a command prompt, you need to add the shortcut extension (.LNK) to your PATHEXT environment variable.



            setx PATHEXT %pathext%;.LNK



            References:



            How can I start applications easily with the Run dialog box?







            share|improve this answer





















            • 1





              This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

              – Synetech
              May 25 '11 at 1:46








            • 1





              That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

              – paradroid
              May 25 '11 at 2:51













            • And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

              – Synetech
              May 25 '11 at 3:01








            • 2





              This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

              – Matt Joiner
              Jul 3 '12 at 17:58






            • 3





              This only works when invoking from the Run As dialog, it didn't work from the command prompt.

              – Matt Joiner
              Jul 3 '12 at 18:41



















            1














            Just create a symbolic link using mklink in a folder in the Path.



            e.g. (in Administrator command prompt)



            mklink "C:UsersMeDocumentsPathsnp.exe" "C:Program Files (x86)Notepad++notepad++.exe"





            share|improve this answer































              0














              The App Paths registry key does exactly this: set the path to notepad++.exe to "program files..." and you'll be able to launch it from Start-Run, cmd, ... just like any executable from a directory in %PATH%.



              HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths


              Reference: https://stackoverflow.com/questions/4822400/register-an-exe-so-you-can-run-it-from-any-command-line-in-windows






              share|improve this answer


























              • This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                – Tahir Hassan
                Jan 23 '15 at 11:09











              • The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                – Todd Partridge
                May 31 '17 at 20:04



















              0














              I didn't like any of the solutions presented here, so I tried something else.




              1. Install link shell extension (more info here)


              2. Create a folder somewhere to store all your shortcuts like Marteen suggests and add it to your %PATH%. I created C:Shortcuts and used Rapid Environment Editor to add it to my PATH.


              3. Right-click the file you want to add to your path (in Explorer) and click "Pick Link Source"


              4. Right-click in folder you just created and click Drop As > Symbolink Link.


              5. Rename the symbolink link if you want.



              That's it. You should be able to access your program via the command-line now. If you just added the new folder to your PATH, you will have to restart cmd.exe or Cmder or ConEmu or whatever it is you use. After that, you can add new programs without restarting.






              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',
                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%2f228592%2fadding-an-exe-to-default-path-without-adding-the-directory%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                6 Answers
                6






                active

                oldest

                votes








                6 Answers
                6






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                17














                You can add a batch script to a directory that is in your path, that looks something like this:



                @echo off

                :: Notepad++ execution

                if [%1]==[-h] goto :HELP
                if [%1]==[--help] goto :HELP
                if [%1]==[/?] goto :HELP
                goto :START

                :START
                start "" /i "%ProgramFiles(x86)%notepad++notepad++.exe" %*
                goto :EOF

                :HELP
                echo -------------------------------
                echo Notepad++ Command Argument Help
                echo -------------------------------
                echo Usage :
                echo.
                echo notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]
                echo.
                echo --help : This help message
                echo -multiInst : Launch another Notepad++ instance
                echo -noPlugins : Launch Notepad++ without loading any plugin
                echo -l : Launch Notepad++ by applying indicated language to the file to open
                echo -n : Launch Notepad++ by scrolling indicated line on the file to open
                echo -c : Launch Notepad++ on scrolling indicated column on the file to open
                echo -x : Launch Notepad++ by indicating its left side position on the screen
                echo -y : Launch Notepad++ by indicating its top position on the screen
                echo -nosession : Launch Notepad++ without any session
                echo -notabbar : Launch Notepad++ without tabbar
                echo -ro : Launch Notepad++ and make the file to open read only
                echo -systemtray : Launch Notepad++ directly in system tray
                echo -loadingTime : Display Notepad++ loading time
                echo -alwaysOnTop : Make Notepad++ always on top
                echo fullFilePathName : file name to open (absolute or relative path name)
                echo.
                goto :EOF

                :EOF


                You can name it notepad++.cmd. The help section allows you to easily get information on the switches.



                I put all such scripts and command line programs in a directory which is added to %PATH%:
                C:UsersPublicCommand
                ...and that directory is synced to all computers and virtual machines.






                share|improve this answer






























                  17














                  You can add a batch script to a directory that is in your path, that looks something like this:



                  @echo off

                  :: Notepad++ execution

                  if [%1]==[-h] goto :HELP
                  if [%1]==[--help] goto :HELP
                  if [%1]==[/?] goto :HELP
                  goto :START

                  :START
                  start "" /i "%ProgramFiles(x86)%notepad++notepad++.exe" %*
                  goto :EOF

                  :HELP
                  echo -------------------------------
                  echo Notepad++ Command Argument Help
                  echo -------------------------------
                  echo Usage :
                  echo.
                  echo notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]
                  echo.
                  echo --help : This help message
                  echo -multiInst : Launch another Notepad++ instance
                  echo -noPlugins : Launch Notepad++ without loading any plugin
                  echo -l : Launch Notepad++ by applying indicated language to the file to open
                  echo -n : Launch Notepad++ by scrolling indicated line on the file to open
                  echo -c : Launch Notepad++ on scrolling indicated column on the file to open
                  echo -x : Launch Notepad++ by indicating its left side position on the screen
                  echo -y : Launch Notepad++ by indicating its top position on the screen
                  echo -nosession : Launch Notepad++ without any session
                  echo -notabbar : Launch Notepad++ without tabbar
                  echo -ro : Launch Notepad++ and make the file to open read only
                  echo -systemtray : Launch Notepad++ directly in system tray
                  echo -loadingTime : Display Notepad++ loading time
                  echo -alwaysOnTop : Make Notepad++ always on top
                  echo fullFilePathName : file name to open (absolute or relative path name)
                  echo.
                  goto :EOF

                  :EOF


                  You can name it notepad++.cmd. The help section allows you to easily get information on the switches.



                  I put all such scripts and command line programs in a directory which is added to %PATH%:
                  C:UsersPublicCommand
                  ...and that directory is synced to all computers and virtual machines.






                  share|improve this answer




























                    17












                    17








                    17







                    You can add a batch script to a directory that is in your path, that looks something like this:



                    @echo off

                    :: Notepad++ execution

                    if [%1]==[-h] goto :HELP
                    if [%1]==[--help] goto :HELP
                    if [%1]==[/?] goto :HELP
                    goto :START

                    :START
                    start "" /i "%ProgramFiles(x86)%notepad++notepad++.exe" %*
                    goto :EOF

                    :HELP
                    echo -------------------------------
                    echo Notepad++ Command Argument Help
                    echo -------------------------------
                    echo Usage :
                    echo.
                    echo notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]
                    echo.
                    echo --help : This help message
                    echo -multiInst : Launch another Notepad++ instance
                    echo -noPlugins : Launch Notepad++ without loading any plugin
                    echo -l : Launch Notepad++ by applying indicated language to the file to open
                    echo -n : Launch Notepad++ by scrolling indicated line on the file to open
                    echo -c : Launch Notepad++ on scrolling indicated column on the file to open
                    echo -x : Launch Notepad++ by indicating its left side position on the screen
                    echo -y : Launch Notepad++ by indicating its top position on the screen
                    echo -nosession : Launch Notepad++ without any session
                    echo -notabbar : Launch Notepad++ without tabbar
                    echo -ro : Launch Notepad++ and make the file to open read only
                    echo -systemtray : Launch Notepad++ directly in system tray
                    echo -loadingTime : Display Notepad++ loading time
                    echo -alwaysOnTop : Make Notepad++ always on top
                    echo fullFilePathName : file name to open (absolute or relative path name)
                    echo.
                    goto :EOF

                    :EOF


                    You can name it notepad++.cmd. The help section allows you to easily get information on the switches.



                    I put all such scripts and command line programs in a directory which is added to %PATH%:
                    C:UsersPublicCommand
                    ...and that directory is synced to all computers and virtual machines.






                    share|improve this answer















                    You can add a batch script to a directory that is in your path, that looks something like this:



                    @echo off

                    :: Notepad++ execution

                    if [%1]==[-h] goto :HELP
                    if [%1]==[--help] goto :HELP
                    if [%1]==[/?] goto :HELP
                    goto :START

                    :START
                    start "" /i "%ProgramFiles(x86)%notepad++notepad++.exe" %*
                    goto :EOF

                    :HELP
                    echo -------------------------------
                    echo Notepad++ Command Argument Help
                    echo -------------------------------
                    echo Usage :
                    echo.
                    echo notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]
                    echo.
                    echo --help : This help message
                    echo -multiInst : Launch another Notepad++ instance
                    echo -noPlugins : Launch Notepad++ without loading any plugin
                    echo -l : Launch Notepad++ by applying indicated language to the file to open
                    echo -n : Launch Notepad++ by scrolling indicated line on the file to open
                    echo -c : Launch Notepad++ on scrolling indicated column on the file to open
                    echo -x : Launch Notepad++ by indicating its left side position on the screen
                    echo -y : Launch Notepad++ by indicating its top position on the screen
                    echo -nosession : Launch Notepad++ without any session
                    echo -notabbar : Launch Notepad++ without tabbar
                    echo -ro : Launch Notepad++ and make the file to open read only
                    echo -systemtray : Launch Notepad++ directly in system tray
                    echo -loadingTime : Display Notepad++ loading time
                    echo -alwaysOnTop : Make Notepad++ always on top
                    echo fullFilePathName : file name to open (absolute or relative path name)
                    echo.
                    goto :EOF

                    :EOF


                    You can name it notepad++.cmd. The help section allows you to easily get information on the switches.



                    I put all such scripts and command line programs in a directory which is added to %PATH%:
                    C:UsersPublicCommand
                    ...and that directory is synced to all computers and virtual machines.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited May 25 '11 at 2:48

























                    answered Jan 3 '11 at 15:54









                    paradroidparadroid

                    19.4k958102




                    19.4k958102

























                        8














                        Create a batch file with contents like the following:



                        @"C:Program FilesGitbingit.exe" %*


                        This should be saved as a .bat file, such as git.bat in a directory that's in your PATH.



                        @ suppresses echoing the command to the invoking shell. The quotations "" prevent white space being interpreted as argument delimiters. %* pastes any arguments to the batch file, to the quoted executable instead.



                        You can now invoke the executable using the part of the batch file name before .bat. In my case, git.



                        References:




                        • Adding Python to Windows path using a small batch file

                        • Adding Python to Windows path using a small batch file - forum thread






                        share|improve this answer
























                        • For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

                          – paradroid
                          Jul 3 '12 at 19:15













                        • @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

                          – Matt Joiner
                          Jul 3 '12 at 20:46


















                        8














                        Create a batch file with contents like the following:



                        @"C:Program FilesGitbingit.exe" %*


                        This should be saved as a .bat file, such as git.bat in a directory that's in your PATH.



                        @ suppresses echoing the command to the invoking shell. The quotations "" prevent white space being interpreted as argument delimiters. %* pastes any arguments to the batch file, to the quoted executable instead.



                        You can now invoke the executable using the part of the batch file name before .bat. In my case, git.



                        References:




                        • Adding Python to Windows path using a small batch file

                        • Adding Python to Windows path using a small batch file - forum thread






                        share|improve this answer
























                        • For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

                          – paradroid
                          Jul 3 '12 at 19:15













                        • @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

                          – Matt Joiner
                          Jul 3 '12 at 20:46
















                        8












                        8








                        8







                        Create a batch file with contents like the following:



                        @"C:Program FilesGitbingit.exe" %*


                        This should be saved as a .bat file, such as git.bat in a directory that's in your PATH.



                        @ suppresses echoing the command to the invoking shell. The quotations "" prevent white space being interpreted as argument delimiters. %* pastes any arguments to the batch file, to the quoted executable instead.



                        You can now invoke the executable using the part of the batch file name before .bat. In my case, git.



                        References:




                        • Adding Python to Windows path using a small batch file

                        • Adding Python to Windows path using a small batch file - forum thread






                        share|improve this answer













                        Create a batch file with contents like the following:



                        @"C:Program FilesGitbingit.exe" %*


                        This should be saved as a .bat file, such as git.bat in a directory that's in your PATH.



                        @ suppresses echoing the command to the invoking shell. The quotations "" prevent white space being interpreted as argument delimiters. %* pastes any arguments to the batch file, to the quoted executable instead.



                        You can now invoke the executable using the part of the batch file name before .bat. In my case, git.



                        References:




                        • Adding Python to Windows path using a small batch file

                        • Adding Python to Windows path using a small batch file - forum thread







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jul 3 '12 at 18:42









                        Matt JoinerMatt Joiner

                        5301725




                        5301725













                        • For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

                          – paradroid
                          Jul 3 '12 at 19:15













                        • @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

                          – Matt Joiner
                          Jul 3 '12 at 20:46





















                        • For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

                          – paradroid
                          Jul 3 '12 at 19:15













                        • @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

                          – Matt Joiner
                          Jul 3 '12 at 20:46



















                        For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

                        – paradroid
                        Jul 3 '12 at 19:15







                        For many programs that will hang up CMD until you close it. You need to use start to avoid that, as shown in my answer.

                        – paradroid
                        Jul 3 '12 at 19:15















                        @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

                        – Matt Joiner
                        Jul 3 '12 at 20:46







                        @paradroid: Thanks, but it's standard terminal behaviour to remain attached to the parent unless asked. The user should do start git rather than have it done for them. The batch script would act better if it execd into the requested process but this isn't possible on Windows: serverfault.com/questions/315077/…. I could prepend call but it would be pedantic and mostly pointless.

                        – Matt Joiner
                        Jul 3 '12 at 20:46













                        3














                        Drag a shortcut to notepad++.exe to C:WindowsSystem32.





                        Alternatively, as suggested by @Synetech inc., you could place your shortcuts in a separate directory (e.g. C:Shortcuts), and then add that directory to %PATH%:



                        setx PATH "%PATH%;C:Shortcuts"




                        As some of the comments indicate, this only works from the Run dialog. In order to get the shortcuts to launch from a command prompt, you need to add the shortcut extension (.LNK) to your PATHEXT environment variable.



                        setx PATHEXT %pathext%;.LNK



                        References:



                        How can I start applications easily with the Run dialog box?







                        share|improve this answer





















                        • 1





                          This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

                          – Synetech
                          May 25 '11 at 1:46








                        • 1





                          That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

                          – paradroid
                          May 25 '11 at 2:51













                        • And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

                          – Synetech
                          May 25 '11 at 3:01








                        • 2





                          This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

                          – Matt Joiner
                          Jul 3 '12 at 17:58






                        • 3





                          This only works when invoking from the Run As dialog, it didn't work from the command prompt.

                          – Matt Joiner
                          Jul 3 '12 at 18:41
















                        3














                        Drag a shortcut to notepad++.exe to C:WindowsSystem32.





                        Alternatively, as suggested by @Synetech inc., you could place your shortcuts in a separate directory (e.g. C:Shortcuts), and then add that directory to %PATH%:



                        setx PATH "%PATH%;C:Shortcuts"




                        As some of the comments indicate, this only works from the Run dialog. In order to get the shortcuts to launch from a command prompt, you need to add the shortcut extension (.LNK) to your PATHEXT environment variable.



                        setx PATHEXT %pathext%;.LNK



                        References:



                        How can I start applications easily with the Run dialog box?







                        share|improve this answer





















                        • 1





                          This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

                          – Synetech
                          May 25 '11 at 1:46








                        • 1





                          That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

                          – paradroid
                          May 25 '11 at 2:51













                        • And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

                          – Synetech
                          May 25 '11 at 3:01








                        • 2





                          This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

                          – Matt Joiner
                          Jul 3 '12 at 17:58






                        • 3





                          This only works when invoking from the Run As dialog, it didn't work from the command prompt.

                          – Matt Joiner
                          Jul 3 '12 at 18:41














                        3












                        3








                        3







                        Drag a shortcut to notepad++.exe to C:WindowsSystem32.





                        Alternatively, as suggested by @Synetech inc., you could place your shortcuts in a separate directory (e.g. C:Shortcuts), and then add that directory to %PATH%:



                        setx PATH "%PATH%;C:Shortcuts"




                        As some of the comments indicate, this only works from the Run dialog. In order to get the shortcuts to launch from a command prompt, you need to add the shortcut extension (.LNK) to your PATHEXT environment variable.



                        setx PATHEXT %pathext%;.LNK



                        References:



                        How can I start applications easily with the Run dialog box?







                        share|improve this answer















                        Drag a shortcut to notepad++.exe to C:WindowsSystem32.





                        Alternatively, as suggested by @Synetech inc., you could place your shortcuts in a separate directory (e.g. C:Shortcuts), and then add that directory to %PATH%:



                        setx PATH "%PATH%;C:Shortcuts"




                        As some of the comments indicate, this only works from the Run dialog. In order to get the shortcuts to launch from a command prompt, you need to add the shortcut extension (.LNK) to your PATHEXT environment variable.



                        setx PATHEXT %pathext%;.LNK



                        References:



                        How can I start applications easily with the Run dialog box?








                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited yesterday









                        Jakob Pearson

                        32




                        32










                        answered May 25 '11 at 1:32









                        Mateen UlhaqMateen Ulhaq

                        2,46952951




                        2,46952951








                        • 1





                          This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

                          – Synetech
                          May 25 '11 at 1:46








                        • 1





                          That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

                          – paradroid
                          May 25 '11 at 2:51













                        • And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

                          – Synetech
                          May 25 '11 at 3:01








                        • 2





                          This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

                          – Matt Joiner
                          Jul 3 '12 at 17:58






                        • 3





                          This only works when invoking from the Run As dialog, it didn't work from the command prompt.

                          – Matt Joiner
                          Jul 3 '12 at 18:41














                        • 1





                          This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

                          – Synetech
                          May 25 '11 at 1:46








                        • 1





                          That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

                          – paradroid
                          May 25 '11 at 2:51













                        • And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

                          – Synetech
                          May 25 '11 at 3:01








                        • 2





                          This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

                          – Matt Joiner
                          Jul 3 '12 at 17:58






                        • 3





                          This only works when invoking from the Run As dialog, it didn't work from the command prompt.

                          – Matt Joiner
                          Jul 3 '12 at 18:41








                        1




                        1





                        This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

                        – Synetech
                        May 25 '11 at 1:46







                        This is the preferred solution (as opposed to a batch file); create a shortcut to it in a (different) directory in the path—don’t pollute Windows’ directories! I have a folder specifically for this purpose called Shortcuts.

                        – Synetech
                        May 25 '11 at 1:46






                        1




                        1





                        That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

                        – paradroid
                        May 25 '11 at 2:51







                        That's the wrong syntax for setx. You do not use an equals sign, and IIRC, you need to enclose the whole path in quotes, if the current %PATH% has spaces in it (which it will).

                        – paradroid
                        May 25 '11 at 2:51















                        And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

                        – Synetech
                        May 25 '11 at 3:01







                        And doesn’t SETX use tildes for variables instead of percents to avoid expanding them? I know that some env-var setting tool does…

                        – Synetech
                        May 25 '11 at 3:01






                        2




                        2





                        This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

                        – Matt Joiner
                        Jul 3 '12 at 17:58





                        This doesn't work. By default (I'm dragging git.exe), "git - Shortcut", renaming this to combinations of "git.exe", "git", "git.cmd" etc. has no effect. It won't acknowledge the shortcut.

                        – Matt Joiner
                        Jul 3 '12 at 17:58




                        3




                        3





                        This only works when invoking from the Run As dialog, it didn't work from the command prompt.

                        – Matt Joiner
                        Jul 3 '12 at 18:41





                        This only works when invoking from the Run As dialog, it didn't work from the command prompt.

                        – Matt Joiner
                        Jul 3 '12 at 18:41











                        1














                        Just create a symbolic link using mklink in a folder in the Path.



                        e.g. (in Administrator command prompt)



                        mklink "C:UsersMeDocumentsPathsnp.exe" "C:Program Files (x86)Notepad++notepad++.exe"





                        share|improve this answer




























                          1














                          Just create a symbolic link using mklink in a folder in the Path.



                          e.g. (in Administrator command prompt)



                          mklink "C:UsersMeDocumentsPathsnp.exe" "C:Program Files (x86)Notepad++notepad++.exe"





                          share|improve this answer


























                            1












                            1








                            1







                            Just create a symbolic link using mklink in a folder in the Path.



                            e.g. (in Administrator command prompt)



                            mklink "C:UsersMeDocumentsPathsnp.exe" "C:Program Files (x86)Notepad++notepad++.exe"





                            share|improve this answer













                            Just create a symbolic link using mklink in a folder in the Path.



                            e.g. (in Administrator command prompt)



                            mklink "C:UsersMeDocumentsPathsnp.exe" "C:Program Files (x86)Notepad++notepad++.exe"






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 28 '15 at 16:26









                            Luigi PlingeLuigi Plinge

                            13418




                            13418























                                0














                                The App Paths registry key does exactly this: set the path to notepad++.exe to "program files..." and you'll be able to launch it from Start-Run, cmd, ... just like any executable from a directory in %PATH%.



                                HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths


                                Reference: https://stackoverflow.com/questions/4822400/register-an-exe-so-you-can-run-it-from-any-command-line-in-windows






                                share|improve this answer


























                                • This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                                  – Tahir Hassan
                                  Jan 23 '15 at 11:09











                                • The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                                  – Todd Partridge
                                  May 31 '17 at 20:04
















                                0














                                The App Paths registry key does exactly this: set the path to notepad++.exe to "program files..." and you'll be able to launch it from Start-Run, cmd, ... just like any executable from a directory in %PATH%.



                                HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths


                                Reference: https://stackoverflow.com/questions/4822400/register-an-exe-so-you-can-run-it-from-any-command-line-in-windows






                                share|improve this answer


























                                • This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                                  – Tahir Hassan
                                  Jan 23 '15 at 11:09











                                • The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                                  – Todd Partridge
                                  May 31 '17 at 20:04














                                0












                                0








                                0







                                The App Paths registry key does exactly this: set the path to notepad++.exe to "program files..." and you'll be able to launch it from Start-Run, cmd, ... just like any executable from a directory in %PATH%.



                                HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths


                                Reference: https://stackoverflow.com/questions/4822400/register-an-exe-so-you-can-run-it-from-any-command-line-in-windows






                                share|improve this answer















                                The App Paths registry key does exactly this: set the path to notepad++.exe to "program files..." and you'll be able to launch it from Start-Run, cmd, ... just like any executable from a directory in %PATH%.



                                HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths


                                Reference: https://stackoverflow.com/questions/4822400/register-an-exe-so-you-can-run-it-from-any-command-line-in-windows







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited May 23 '17 at 12:41









                                Community

                                1




                                1










                                answered Feb 12 '13 at 18:45









                                patrauleapatraulea

                                4116




                                4116













                                • This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                                  – Tahir Hassan
                                  Jan 23 '15 at 11:09











                                • The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                                  – Todd Partridge
                                  May 31 '17 at 20:04



















                                • This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                                  – Tahir Hassan
                                  Jan 23 '15 at 11:09











                                • The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                                  – Todd Partridge
                                  May 31 '17 at 20:04

















                                This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                                – Tahir Hassan
                                Jan 23 '15 at 11:09





                                This will not make it executable from cmd - only from start-run, or in cmd you have to prefix it with "start" as in "start myapp.exe"

                                – Tahir Hassan
                                Jan 23 '15 at 11:09













                                The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                                – Todd Partridge
                                May 31 '17 at 20:04





                                The Command Prompt this, agreed, lacks the ability to recognize this variable. PowerShell does recognize it. This solution, more importantly, only applies to the directory, and hence, off topic.

                                – Todd Partridge
                                May 31 '17 at 20:04











                                0














                                I didn't like any of the solutions presented here, so I tried something else.




                                1. Install link shell extension (more info here)


                                2. Create a folder somewhere to store all your shortcuts like Marteen suggests and add it to your %PATH%. I created C:Shortcuts and used Rapid Environment Editor to add it to my PATH.


                                3. Right-click the file you want to add to your path (in Explorer) and click "Pick Link Source"


                                4. Right-click in folder you just created and click Drop As > Symbolink Link.


                                5. Rename the symbolink link if you want.



                                That's it. You should be able to access your program via the command-line now. If you just added the new folder to your PATH, you will have to restart cmd.exe or Cmder or ConEmu or whatever it is you use. After that, you can add new programs without restarting.






                                share|improve this answer






























                                  0














                                  I didn't like any of the solutions presented here, so I tried something else.




                                  1. Install link shell extension (more info here)


                                  2. Create a folder somewhere to store all your shortcuts like Marteen suggests and add it to your %PATH%. I created C:Shortcuts and used Rapid Environment Editor to add it to my PATH.


                                  3. Right-click the file you want to add to your path (in Explorer) and click "Pick Link Source"


                                  4. Right-click in folder you just created and click Drop As > Symbolink Link.


                                  5. Rename the symbolink link if you want.



                                  That's it. You should be able to access your program via the command-line now. If you just added the new folder to your PATH, you will have to restart cmd.exe or Cmder or ConEmu or whatever it is you use. After that, you can add new programs without restarting.






                                  share|improve this answer




























                                    0












                                    0








                                    0







                                    I didn't like any of the solutions presented here, so I tried something else.




                                    1. Install link shell extension (more info here)


                                    2. Create a folder somewhere to store all your shortcuts like Marteen suggests and add it to your %PATH%. I created C:Shortcuts and used Rapid Environment Editor to add it to my PATH.


                                    3. Right-click the file you want to add to your path (in Explorer) and click "Pick Link Source"


                                    4. Right-click in folder you just created and click Drop As > Symbolink Link.


                                    5. Rename the symbolink link if you want.



                                    That's it. You should be able to access your program via the command-line now. If you just added the new folder to your PATH, you will have to restart cmd.exe or Cmder or ConEmu or whatever it is you use. After that, you can add new programs without restarting.






                                    share|improve this answer















                                    I didn't like any of the solutions presented here, so I tried something else.




                                    1. Install link shell extension (more info here)


                                    2. Create a folder somewhere to store all your shortcuts like Marteen suggests and add it to your %PATH%. I created C:Shortcuts and used Rapid Environment Editor to add it to my PATH.


                                    3. Right-click the file you want to add to your path (in Explorer) and click "Pick Link Source"


                                    4. Right-click in folder you just created and click Drop As > Symbolink Link.


                                    5. Rename the symbolink link if you want.



                                    That's it. You should be able to access your program via the command-line now. If you just added the new folder to your PATH, you will have to restart cmd.exe or Cmder or ConEmu or whatever it is you use. After that, you can add new programs without restarting.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Mar 20 '17 at 10:16









                                    Community

                                    1




                                    1










                                    answered Jul 29 '15 at 0:52









                                    mpenmpen

                                    4,324114063




                                    4,324114063






























                                        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%2f228592%2fadding-an-exe-to-default-path-without-adding-the-directory%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

                                        Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                                        VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                                        Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...