"cmd: command not found" from "start" command (open directory in Windows Explorer) in git bash?
Solution 1
Even though it shouldn't be necessary, try the following:
/c/Windows/System32/cmd.exe //c 'start .'
start
is a command that is internal to cmd.exe
, so it must be invoked with cmd /c
(and Git Bash apparently requires doubling /
chars. to be recognized as cmd
-style option-prefix characters).
However, there is a shell-script wrapper for it - /usr/bin/start
- which does this for you.
In your case, this shell script unexpectedly complains about not finding cmd
, even though /c/WINDOWS/system32
should be in your $PATH
environment variable by default - do check that variable and see if it's being modified unexpectedly somewhere.
$PATH
is initially defined in /etc/profile
, but can be overridden / modified in ~/.bash_profile
, for instance.
/etc/profile
also contains helpful links in comments:
# Some resources...
# Customizing Your Shell: http://www.dsl.org/cookbook/cookbook_5.html#SEC69
# Consistent BackSpace and Delete Configuration:
# http://www.ibb.net/~anne/keyboard.html
# The Linux Documentation Project: http://www.tldp.org/
# The Linux Cookbook: http://www.tldp.org/LDP/linuxcookbook/html/
# Greg's Wiki http://mywiki.wooledge.org/
Solution 2
I had a similar problem because my path had %SystemRoot%\system32 included. It turns out that the env variable %SystemRoot% is not statically defined, but automatically included in the environment when starting cmd.exe or power shell. Since MINGW64's bash is neither, it just saw %SystemRoot%/system32 and could not traverse that to find cmd.exe.
Changing path to use C:\Windows\System32 cured this.
Charles Duffy
Just this guy, see? Keybase identity @ https://keybase.io/charlesdyfisnet
Updated on December 02, 2022Comments
-
Charles Duffy over 1 year