Search code examples
firefoxexelazarus

Start .exe files from command line windows from other directories


When I start firefox from command line, i does not matter in which directory I am. When I want to start for example lazarus i need to go to directory where file lazarus.exe is located.

Why can I start firefox.exe from everywhere and some other .exe files i must go to right directory

C:\Users\Seda> start firefox.exe       // run perfectly
C:\Users\Seda> start lazarus.exe       // can not find exe file
C:\Users\Seda> cd ..
C:\Users> cd ..
C:\>cd Lazarus
C:\Lazarus> start lazarus.exe // .exe file started

Solution

  • What Firefox does is to add the path to its executable to the "App Paths" subkey, which is the preferred solution against modifying the 'path' environment variable. To make the same for lazarus, you can add a

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\lazarus.exe
    

    key having the (Default) value of the path to the executable, e.g.: X\...\lazarus.exe

    To have an effect on all users, you can use the machine counterpart of course

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
    


    See documentation for more details.