Search code examples
windowslinuxbashbatch-filesh

Run .bat in Linux environment


Is there any way to run .bat file in Linux environment? I have a couple of .bat files, the purpose of them is to call mvn install:install-file scripts. Thus nothing OS dependent is in the scripts.

Thank you,


Solution

  • You can use wine or dosbox, but in general there is no known bat interpreter for linux. There are, however, implementations of various unix shells for windows, there's even a standard toolkit, Windows Services for UNIX (a.k.a. SUA), which include ksh implementation and many other nice goodies, so if you want it OS-transparent, you could consider using that and write your scripts in a POSIX-compliant shell scripting language.

    --- edit --- On the other hand, if your script contains nothing else other than an mvn <params>, you can just make sure the file has execute permissions (x flag), prepend it with a shell interpreter (like /bin/bash script.bat) and have a go at it. Success not guaranteed, though.