I installed Git on drive D:, but when I open a new cmd.exe Window and type git --version at the prompt, it showed that error launching git:
C:\Users\25011>git --version
error launching git:
It seems like the path is correct. With "选择管理员: (en-auto-translate: Select Administrator:) C:\WINDOWS\system32\cmd.exe":
C:\Users\25011>echo %PATH%
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\r12.9\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\r12.9\libnvp;D:\MPICH2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\r1.0\;C:\Windows\System32\OpenSSH\rC:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\r1.0\;C:\WINDOWS\System32\OpenSSH\rD:\latextextlive\2023\bin;D:\MATLAB SOFTWARE\runtime\wind4;C:\Program Files\dotnet\rC:\Program Files\Pandoc\rD:\pandoc\rD:\CUDA\rlib\r64;D:\CUDA\rinclude;D:\CUDA\rib;D:\go\bin;E:\matlab\bin;D:\apache-tomcat-9.0.97-windows-x64\apache-tomcat-9.0.97/bin;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files\Microsoft SQL Server\r20\Tools\Binn\rC:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\r1.0\;C:\WINDOWS\System32\OpenSSH\rD:\TDM-GCC-64\bin;D:\Java\jdk-17\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2025.2.0\rC:\Program Files\Bandizip\rD:\nodejs\rD:\anaconda3;D:\anaconda3\Scripts
>>> ;D:\Git\Git\cmd; <<<
C:\Users\25011\AppData\Local\Microsoft\WindowsApps;D:\Microsoft VS Code\bin;C:\Users\25011\Desktop\MindW\bin;D:\latextextlive\2023\bin\windows;D:\python\PyCharm Community Edition 2023.2.1\bin;C:\Users\25011\go\bin;D:\IntelliJ IDEA 2022.1.3\bin;D:\IntelliJ IDEA Community Edition 2024.3.5\bin;C:\Users\25011\AppData\Roaming\npm;
and
C:\Users\25011>where git
D:\Git\Git\cmd\git.exe
But when I reinstalled Git on C:\Programs Files, I cannot reproduce the error.
More context:
Another similar issue happened when I used Anaconda. I installed Anaconda on drive D:, when I opened my cmd and typed conda --version, it showed:
Unable to create process using 'D:\anaconda3\python.exe D:\anaconda3\Scripts\conda-script.py --version'"
It confuses me, because when I opened the terminal with Administrator privileges, it worked correctly.
Then I checked the privilege of drive D:, D drive privilege, I can read and execute. Please help me with that annoying problem.
I tried to installed Anaconda on drive E: or in C:\User, it did not work either. I checked that Python.exe under Anaconda is working well but conda.exe I was unable to work well for me.
There is also a tricky problem that sometime I can see the correct answer in normal cmd.exe (without administrator): picture of conda--verison


$PATHin the terminal instead of having a statement about it in the question... followed by a listing of the directory where git is followed by an attempt to run a git command.