Add installed location to PATH environment variable #9991
Replies: 3 comments 4 replies
-
Hi MattTheCuber, First: Hello! ^^ Welcome! To add your install directory to the PATH environment variable during the installation of your Tauri app on Windows, you can use a custom script and make a few changes to your Step-by-Step Guide
Here’s How You Can Do It1. Create the PowerShell ScriptCreate a file named # add_to_path.ps1
# Define the install directory (change this to your actual path)
$installDir = "C:\Path\To\Your\Installation\Directory"
# Get the current PATH environment variable
$oldPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
# Check if the directory is already in PATH
if ($oldPath -notmatch [regex]::Escape($installDir)) {
# Add the install directory to PATH
$newPath = "$oldPath;$installDir"
[System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::Machine)
Write-Output "Successfully added $installDir to PATH"
} else {
Write-Output "$installDir is already in PATH"
} 2. Modify Your
|
Beta Was this translation helpful? Give feedback.
-
It appears Tauri v2 might include this feature: https://v2.tauri.app/reference/config/#installerhooks |
Beta Was this translation helpful? Give feedback.
-
Under Windows, apps like Chrome or Firefox are typically registered and not put into path. https://learn.microsoft.com/en-us/windows/win32/shell/app-registration#registering-applications |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Forgive my ignorance in this discussion on the internals of Tauri, I am very new to the framework.
We recently finished creating a Tauri application (a Python web app) that can be bundled as an installer for Windows. We want to bundle additional executables (created with PyInstaller) that provide CLI utilities for the system. Note, these are completely separate from and not used by the web app. My first thought was to include them in the
tauri.bundle.externalBin
configuration setting. This correctly packages the executables and copies them to the install directory on Windows. Obviously, these executables can not be run from a terminal without being in the directory or adding the install directory to thePATH
environment variable.What is your recommendation for adding the install directory to the
PATH
environment variable during installation? Is there a way to have a script/command run during the installation to accomplish this? Currently, we are only focused on Windows, but in the future we may want a cross-compatible solution. Maybe we are thinking about this the wrong way and there is a better alternative for bundling additional utilities?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions