Linux.com

Home Learn Linux Linux Answers High Performance If possible , how to run .bat files in Linux ?
Answers
  • Sorry for the double post LOL , didn't realize it.

    Answered by Hurtboss
    5 years ago
    0 0
  • You cannot run the .bat shell on Linux, as it is a script for the DOS/Windows shell; if you could run it, then the options to java would likely be wrong because of the OS.

    However, run.bat is likely a simple script. If you can post it in the forums, you may find someone able to "translate" it to a bash shell script that will run on Linux. You will also, obviously, need to have Java installed, which you can download from java.sun.com

    Answered by kjoyner
    5 years ago
    0 1
  • I'll post it here , but I think it won't work , simply because this Client supposedly connects to other text to run , but it won't hurt to give it a try

    @ECHO OFF

    title jvm

    echo jvm

    echo Newest client running

    JAVA -Xmx500m EGUI

    Answered by Hurtboss
    5 years ago
    0 0
  • First sorry for the spelling I am dislex.... (if the admin can edit this please feel free to do so)

    .bat files are inded DOS files and can not be directley run on linux but thay can be Opened/Read/Edited iver in a termail using a basic text editor like VIM or Nano. Also in any text editor like gedit on gnome or kedit on KDE. But please rember that if you open/edit it in a wordprosser like OpenOffice then the chances are the file will be saved in a format that is difent (not plain text) from the ovignail.

    Thay can be run in a emulater like DOSBOX.

    It may also beposible to port/tranlate it to a shell script (.sh) file but you will have to have shell scrips programming knolige to do this by hand as that is as fare as I know the only way. (I know of no automatic tool)

    Answered by Topcatsteve
    5 years ago
    0 0
  • P.S this may not be the right place to put this but it is all connect to the arignal question.

    If you did tranlat/port it and it did something usfull there is also the question of "rights"/"access" control.

    All files in Linux/Unix have 9 levels of access (Read, Write, Exaquit) for the User, Group and Others. Hence when you do a "ls" (list) in a termail next to the file there are a group of 9 letters (RWXRWXRWX) some of them displayed some not

    So for a file e.g run.sh you will see one of the flowing in a list:

    RWXRWXRWX run.sh

    or
    RWXR.XR.. run.sh

    or R..XR..XR..X run.sh

    or somethin simler. The meanings are as flowes

    the first 3 letters are for the Owener/User
    the next 3 letters are for the Group
    and the finle are for Others

    So if the first letter is R that means the Owner/User can Read the file.
    if the second letter is W that mean the Owner/User can Write/edit/delete the file
    if the 3rd letter is x that means the file can be exaquarted/run

    so if the 3rd,6th and 9th letter is X then the file is exaquable by eveory one.

    and so on I hope this helps

    Answered by Topcatsteve
    5 years ago
    0 0
  • [quote name="Kelly Joyner"]You cannot run the .bat shell on Linux, as it is a script for the DOS/Windows shell; if you could run it, then the options to java would likely be wrong because of the OS.

    Just a polight note Not all scrips are "java"

    Answered by Topcatsteve
    5 years ago
    0 0
  • Hello Hurtboss,

    Try renaming the bat file to run.sh, as others have suggested.

    Then open run.sh in a text editor and remove the lines:

    @ECHO OFF

    title jvm

    echo jvm

    echo Newest client running


    And add this line:

    #!/bin/sh

    This line makes it work like a bat file does under windows.

    Next change the line:

    JAVA -Xmx500m EGUI

    so that the word Java is all lowercase:

    java -Xmx500m EGUI

    The reason for this is that under Unix (which Linux is based off of) most applications have lower names.

    So you should have something similar to:

    #!/bin/sh
    java -Xmx500m EGUI


    Now, if you are using a terminal, run

    chmod u+x run.sh

    This makes it executable, so that you can run it. (it sets the X bit that Steve Tompkins-MacQueen mentioned.) This is unlike Windows, where anything with a .exe extension will be launched as a an executable. This goes into a bit more depth if you would like: https://help.ubuntu.com/community/FilePermissions

    And then

    ./run.sh

    to launch the program. And that should be it.

    If you aren't using a terminal, right click on the run.sh and select properties. Then find where it allows you to change permissions (or if it has a button that says "launch as executable" or something similar, select that and skip the next step). In permissions, make certain that it is set to be executable.

    Then double click on run.sh and it should work.

    Hope that helps :)

    By the way, what game is it, if I may ask?

    Answered by xentalion
    5 years ago
    0 0
  • No you cant run .bat files on linux.

    You have to write shell script instead.

    If you want to learn shell scripting this is a very good starting point:
    [url]http://tldp.org/LDP/abs/html/index.html[/url]

    Answered by kunal
    5 years ago
    0 0
  • you can also try to run virtualbox in your linux system and install windows in one of the virtual machine and use your dos prompt and do anything you want in the vm, reinstall it if it get corrupted. unlimited OS.

    Answered by abrenar
    5 years ago
    0 0
Please register/login to answer this question. Click here to login
Similar Questions Found
Questions from category High Performance

Upcoming Linux Foundation Courses

  1. LFD331 Developing Linux Device Drivers
    13 Oct » 17 Oct - Virtual
    Details
  2. LFS425 Linux Performance Tuning Crash Course
    16 Oct » 16 Oct - Düsseldorf, Germany
    Details
  3. LFS220 Linux System Administration
    20 Oct » 23 Oct - Virtual
    Details

View All Upcoming Courses

Community Answers - Search


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board