I am working on the Learn The Command Line lesson; Windows Command-Line. I opened up Get Bash on my PC and none of the commands for Windows in the Bash to Windows Command Prompt Translation Guide seem to work. Can someone let me know why the only one that did work is the Windows command ‘dir’?
Be sure you are actually running the Git Bash shell and not cmd.exe, and be sure that Git Bash is properly added to your $PATH. You may need to uninstall and reinstall Git Bash, and make sure that the option to “Add to PATH” is checked
Do Bash commands work in PowerShell?
No, but my experience is that PowerShell handles the Python interpreter and $PATH modification better than cmd.exe. I noticed that when trying to run
python -m python-script in cmd.exe, I would get random errors, while running the same command in PShell worked.
cmd.exe is ancient and hasn’t really been touched since WinXP. PowerShell was a major step in the right direction and with the new Windows Terminal coming with Windows 11, we will finally get a near-clone of bash in Windows without needing Git Bash, mingw, or some other third party wrapper. I started using it last night and the experience compared to even PShell is amazing. But that doesn’t solve the original issue here, which is that it seems likely the Git Bash installation failed to properly add itself to $PATH.
On that note, to @nomantyke: When you reinstall, Git Bash, be sure to run the installer as administrator, I forgot to mention that.