Search code examples
command-linerediscommand-line-interfaceredis-cli

How to run a Windows command from any folder?


Some CLI commands work from only specific folders; I want to make them run globally, from anywhere.

I installed redis-cli.exe in the path c:/redis/redis-cli.exe.
Now when I open a cmd in c:/redis/ and run redis-cli ping, it works.
However, if I run it from some other folder, it throws an error saying
'redis-cli' is not recognized as an internal or external command, operable program or batch file.

In contrast, Chocolatey or npm runs from a cmd console opened in any folder.


Solution

  • Solution: Add the path to that exe in your environment variables.

    So for c:/redis/redis-cli.exe, add the value c:/redis to PATH in your environment variables.