Adding chia.exe to your PATH on Windows for easy use

I’ve been a UNIX use for as long as I can remember so I don’t have a ton of experience with Powershell. Here’s an easy way to add the Chia EXE to your path so you can run chia plots check instead of going into the daemon directory to run it there.

Control Panel > View Advanced System Settings > Env Variables > Add your chia DIR to your PATH like so:

Or you can add the path to your PS profile and it will run on each PS boot.

$ENV:LOCALAPPDATA\chia-blockchain\app-*\resources\app.asar.unpacked\daemon

Or add an alias:

new-alias chia $ENV:LOCALAPPDATA\chia-blockchain\app-*\resources\app.asar.unpacked\daemon\chia.exe

Thanks @login-taken for the wildcard tip.

Enjoy!

Source: How To Add A Shortcut To The Chia Command Line CLI In Powershell - YouTube

4 Likes

Very useful! I didn’t want to spend the time to figure this out, but now I did it because of you :grinning_face_with_smiling_eyes:

Just a tip: You can just search for “view advanced system settings” to go straight there. My eyes must be tired; I couldn’t see it in the Control Panel.

2 Likes

PowerShell will do globbing with a * wildcard like this:

$ENV:LOCALAPPDATA\chia-blockchain\app-*\resources\app.asar.unpacked\daemon

With a PowerShell profile you could add an alias just to chia.exe as other files in the path are never called directly anyways:

new-alias chia $home\scoop\apps\chia-blockchain\current\resources\app.asar.unpacked\daemon\chia.exe

Here chia was installed via scoop from this bucket.

3 Likes

On a second thought adding to PATH is superior advice, as people use start-process and it wants a file not an alias. So again, this is how to do it in your $profile, or each time in a PowerShell script or the command line:

$ENV:PATH += $ENV:LOCALAPPDATA\chia-blockchain\app-*\resources\app.asar.unpacked\daemon

4 Likes

hrm, this didn’t work for me. I had to do

$chiaPath = Get-ChildItem "$ENV:LOCALAPPDATA\chia-blockchain\app-*\resources\app.asar.unpacked\daemon"
$ENV:PATH += ";$chiaPath"

3 Likes