'ollama' is not recognized as an internal or external command, operable program or batch file. in cmd, or The term 'ollama' is not recognized as the name of a cmdlet in PowerShell, means the shell you typed in cannot find ollama.exe on its PATH. Run it by its full path, or add its folder to the PATH of that terminal, and the same command answers.

In the test below the per-user Windows app had put ollama.exe in %LOCALAPPDATA%\Programs\Ollama. With that folder missing from a shell's PATH, both cmd and PowerShell refused the command; with the folder added back for the session, ollama --version printed ollama version is 0.40.14.

The error

In cmd:

C:\> ollama --version
'ollama' is not recognized as an internal or external command,
operable program or batch file.
C:\> where ollama
INFO: Could not find files for the given pattern(s).

In Windows PowerShell 5.1:

PS> ollama --version
ollama : The term 'ollama' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ollama --version
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (ollama:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Why it happens

A bare command name is looked up in the folders listed in the shell's PATH variable. The reproduction removed every PATH entry containing "Ollama" from one shell's own process, which is the situation of a terminal whose PATH lacks the folder: cmd printed the "not recognized" lines, where ollama found nothing, and PowerShell raised a CommandNotFoundException. The program itself was still on disk and still worked by its full path.

On this PC the folder is in the user PATH. You can check that without changing anything, from any shell where ollama does run:

PS> (Get-Command ollama).Source
C:\...\AppData\Local\Programs\Ollama\ollama.exe
PS> [Environment]::GetEnvironmentVariable('Path','User') -split ';' | Select-String -SimpleMatch Ollama

C:\...\AppData\Local\Programs\Ollama

If the second command prints the folder but your terminal still says "not recognized", a terminal started after the PATH change sees it. That was not tested here, and a new tab inside an app that was already open may still carry the old copy, so restart the terminal app. If it prints nothing, the folder is not in your user PATH and you have to add it yourself or reinstall; that was not tested here either. Only the user part of PATH was read here; the system part was not checked.

The fix

Run it by its full path:

PS> & "$env:LOCALAPPDATA\Programs\Ollama\ollama.exe" --version
ollama version is 0.40.14

Or add the folder to the PATH of the current PowerShell session only:

PS> $env:Path += ";$env:LOCALAPPDATA\Programs\Ollama"
PS> ollama --version
ollama version is 0.40.14

In cmd the same session-only change was run as one line, set "PATH=%PATH%;%LOCALAPPDATA%\Programs\Ollama" & ollama --version, and it printed the same version line. Both changes end with the window; nothing was written to the user or system PATH. If your install went somewhere else, use the folder that (Get-Command ollama).Source or File Explorer shows you.

How it was reproduced

Windows 11 with the Ollama Windows app 0.40.14 installed per user, Windows PowerShell 5.1.26100 and cmd 10.0.26300. A script started a fresh PowerShell, removed the Ollama entries from its own process PATH, then ran cmd /c "ollama --version 2>&1", cmd /c "where ollama 2>&1" and powershell -NoProfile -Command "ollama --version", then the two fixes. The user PATH was only read.

Frequently asked

Why is ollama not recognized in cmd after installing it?
The shell cannot find ollama.exe in the folders on its PATH. Check whether your user PATH names the Ollama folder; if it does, start the terminal app again, and if it does not, add the folder or run ollama.exe by its full path.
Where is ollama.exe installed on Windows?
On the test PC the Windows app put it in %LOCALAPPDATA%\Programs\Ollama. In a shell where ollama works, (Get-Command ollama).Source prints the exact path.
How do I add Ollama to PATH for one PowerShell session?
Run $env:Path += ";$env:LOCALAPPDATA\Programs\Ollama" and then ollama --version. The change lasts until the window is closed and does not touch the user or system PATH.

More decoded errors in the Fixes category. Getting the same message inside WSL is a different case, covered in ollama: command not found in WSL with the Windows app.