top of page
Writer's pictureMajestic Logic

How to execute a file from any directory

Updated: Oct 30, 2023


In the world of Windows 10, having quick access to your favorite command-line tools and applications can significantly boost your productivity. One way to achieve this is by adding an executable to the system PATH. In this blog post, we'll guide you through the process, step by step, so you can seamlessly access your desired applications without having to navigate to their directory each time.


Step 1: Find the Executable Before you can add an executable to the PATH, you need to know the full path to the executable file. This information is crucial, so make sure you have it at your fingertips.

Step 2: Open System Properties To get started, press Windows + X on your keyboard and select "System," or alternatively, right-click on "This PC" or "My Computer" (depending on your Windows version) and choose "Properties."

Step 3: Access Advanced System Settings In the System window, click on "Advanced system settings" on the left sidebar. This will open the System Properties window.

Step 4: Environment Variables In the System Properties window, click the "Environment Variables" button, usually found at the bottom of the window.

Step 5: Edit User or System PATH In the Environment Variables window, you'll see two sections: "User variables" and "System variables." Here, you need to decide whether you want to make the executable available for just your user account or for all users on the system.

  • To make it available to your user account, select "Path" under User variables.

  • To make it available to all users on the system, select "Path" under System variables.

Step 6: Edit Path Click the "Edit" button, which will open the Edit Environment Variable window.

Step 7: Add New Path In the Edit Environment Variable window, click the "New" button. This is where you'll add the path to the directory where the executable is located. You can paste the path or browse to it. Once you've added it, click "OK" to close the Edit Environment Variable window.

Step 8: Apply Changes After adding the path, make sure you click "OK" to close the Environment Variables window.

Step 9: Restart or Reopen Command Prompt For the changes to take effect, you should either restart your computer or open a new Command Prompt or PowerShell window.

Conclusion: By following these steps, you can add an executable to the Windows 10 PATH, making it easily accessible from the command line without the need to specify its full path every time you want to use it. This simple process can save you time and streamline your workflow, allowing you to make the most of your preferred command-line tools and applications.

2 views0 comments

Comentarios


bottom of page