'bat file wont run in bash terminal
I have default windows CMD with its own syntax which I don't want and also git bash terminal, with a bit different syntax which I need. I have .bat file that I wrote for git bash syntax. but when I double click it it runs through windows default CMD and as a result of wrong syntax it fails. what can I do to maybe make git bash default terminal?
Solution 1:[1]
You DO realize that messing with the default command interpreter isn't a good idea? Both on Windows and Linux?
First, a batch is associated with cmd (in fact, %COMSPEC%). On Windows, files are launched accordingly to their extension. There is nothing like shebangs or other badly portable tricks: extension it is. So you must change this association if you want to run it through a double-click.
Second, a batch is a batch. You don't put Python code inside a ".cpp" file, right? You don't name a PDF with a ".jpeg" extension? So why do you put shell code into a batch file?
==> You should write a shell script (extension ".sh" or ".bash") instead, and associate it properly with your bash interpreter.
BTW, you should also look at WSL2 and what it allows, if you want (near) native bash support under Windows.
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 | Wisblade |
