Running an exe file just by giving it's name to cmd

I am running an exe file created with python from the powershell.

I am running it by doing

& C\users\rey\.....\main.exe

what I want to is to just pass the main.exe to the command prompt to run the exe file but when I do that now I get the error that:

"main.exe is not recognized as a cmdlet function, function, script type ...."

How would I go about doing this?


Keep the path of the file or the path of the folder containing the file in system environment variables. Then you can use it directly.