'git bash under Windows 10 doesn't execute vagrant version

Installed git version 2.35.1.windows.2 under Windows 10. From git bash, run: vagrant version. Opens up a dos window, executes, and closes. So I cannot use these types of commands, like vagrant version. 100% repeatable.

If I run git bash elevated, then I can see the command completes as expected.

Expected behavior from a Windows 10 machine that works, with git running not elevated:

vagrant version
Installed Version: 2.2.19
Latest Version: 2.2.19

Both machines, the one that works as expected and the one that fails, git was installed as regular user, with git being installing under: C:\Users<username>\AppData\Local\Programs\Git\git-bash.exe --cd-to-home



Solution 1:[1]

Try, with the problematic PC, to use a simplified PATH and see if that works:

Open a CMD and type:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set "GH=%LOCALAPPDATA%\Programs\Git"
set "PATH=%GH%\bin;%GH%\cmd;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%"
set "PATH=C:\path\to\vagrant.exe;%PATH%"

Replace C:\path\to\vagrant.exe by the parent folder of vagrant.exe, do not include vagrant.exe itself in the %PATH%.

Test if the issue persists then in that CMD session.

bash
vagrant version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC