- 3 шага, чтобы открыть файл с расширением BAT
- BAT расширение файла
- Как открыть файл BAT?
- Шаг 1: Установите программу, которая поддерживает BAT файлы
- Подсказка для пользователей Mac OS
- Шаг 2: Найти и скачать подходящее программное обеспечение
- Эквивалент.bat в mac os
- 3 ответов
- Equivalent of .bat in mac os
- 3 Answers 3
- Running .bat files on a Mac
- 4 Answers 4
- Related
- Hot Network Questions
- Subscribe to RSS
- Question: Q: opening .bat files on my mac
- All replies
3 шага, чтобы открыть файл с расширением BAT
Обычно решить проблему с файлом BAT просто — просто установите соответствующее программное обеспечение и откройте файл. Прочтите руководство и откройте файл BAT прямо сейчас!
- 1. BAT расширение файла
- 2. Как открыть файл BAT?
- 2.1 Установите программу, которая поддерживает BAT файлы
- 2.2 Найти и скачать подходящее программное обеспечение
- 2.2.1 Программы, поддерживающие файлы с расширением BAT
- 2.3 Проверьте BAT файл на наличие ошибок
- 3. Подобные расширения файлов
BAT расширение файла
- Тип файла Batch Format (executable)
- Разработчик файлов Microsoft
- Категория файла Исполняемые файлы
- Рейтинг популярности файлов
Как открыть файл BAT?
Может быть несколько причин, по которым система не поддерживает данный файл. В случае расширения BAT вероятно, что ни одна из установленных программ не поддерживает данный тип файла. Поэтому пользователь должен предпринять следующие шаги
Шаг 1: Установите программу, которая поддерживает BAT файлы
Если приложение, поддерживающее файлы BAT, установлено в системе пользователя, но не используется для открытия таких файлов по умолчанию, щелкните правой кнопкой мыши значок файла и выберите в меню пункт «Открыть с помощью». Затем выберите подходящее приложение и установите флажок «Всегда использовать выбранное приложение для открытия файлов такого типа». Система будет хранить эту информацию в своем реестре и использовать выбранную программу для открытия файлов с расширением BAT по умолчанию.
Подсказка для пользователей Mac OS
Для пользователей Mac OS процедура аналогична — откройте меню файла, щелкнув правой кнопкой мыши по файлу BAT, выберите опцию «Информация» и выберите опцию «Открыть с помощью программы». В подменю выберите приложение и нажмите кнопку «Изменить все».
Шаг 2: Найти и скачать подходящее программное обеспечение
Невозможность открыть файлы BAT также может быть связана с отсутствием какого-либо приложения, поддерживающего данный файл, устанавливаемого в системе. В этом случае пользователь должен загрузить и установить одно из следующих приложений. После установки система автоматически свяжет вновь установленное приложение с файлами BAT. Если этот шаг не пройден, см. Шаг 1.
Источник
Эквивалент.bat в mac os
в настоящее время я использую .bat файл, который используется для вызова файла java. Если бы я хотел использовать ту же функциональность в Mac OS, какие изменения формата я бы сделал? (если только .bat эквивалентом в Mac OS является ?)
любая помощь будет оценили.
3 ответов
обычно вы можете создать сценарий bash для Mac OS, где вы помещаете подобные команды, как в пакетном файле. Для вашего случая создайте файл bash и поместите ту же команду, но измените обратные косые черты с обычными.
ваш файл будет выглядеть примерно так:
измените папки в пути выше на соответствующий.
затем сделайте этот скрипт исполняемым: откройте терминал и перейдите в папку со скриптом. Затем измените права на чтение-запись-выполнение для этого файла, выполняющего команду:
затем вы можете запустить его как любой другой обычный сценарий: ./scriptname.sh
или вы можете запустить его, передавая файл в bash:
общая конвенция будет заключаться в том, чтобы поместить его в a .sh файл, который выглядит так —
обратите внимание, что ‘\’ стать ‘/’.
вы можете выполнить как
или установите бит x в файле
а потом просто позвоните
Я нашел полезную информацию на странице форума, приведенной ниже.
Из этого, в основном предложения в жирном формате, мой ответ:
сделайте версию скрипта bash (shell) вашей .bat файл (как и другие
ответы, с \ изменено на / в пути к файлам). Например:
затем переименуйте его, чтобы иметь расширение файла Mac OS .command .
Это должно заставить скрипт работать с помощью терминала приложение.
если пользователь приложения использует версию скрипта bash файла в Linux или
запустив его из командной строки, им нужно добавить исполняемые права
(изменить режим bits) с помощью этой команды, в папке, которая имеет файл:
на страница форума вопрос:
Добрый день, [. ] Мне интересно, есть ли какие-то «простые» правила для написания эквивалент
из файла Windows (DOS) bat. Я хотел бы просто нажать на файл и его запустить.
информация из некоторых ответов после вопроса:
напишите сценарий оболочки и дайте ему расширение».команда.» Например:
— 23 Марта 2010, Tony T1.
DOS .Файл BAT был попыткой довести до MS-DOS что-то вроде идеи UNIX скрипт.
В общем, UNIX позволяет вам сделать текстовый файл с командами в нем и запустить его, просто отметив
текстовый файл как исполняемый файл (вместо того, чтобы дать ему определенный суффикс). Вот как это делает OS X.
однако OS X добавляет функцию, которая если вы дадите файлу суффикс .command , Finder
будет работать терминал.приложение для его выполнения (подобно тому, как файлы BAT работают в Windows).
в отличие от MS-DOS, однако UNIX (и OS X) позволяет указать, какой интерпретатор используется
для сценария. Интерпретатор-это программа, которая считывает текст из файла и делает что-то
с ним. [. ] В UNIX вы можете указать, какой интерпретатор использовать, сделав первую строку в
текстовый файл, который начинается с «#!- по тропинке к переводчику. Например.[ ..]
— 23 Марта 2010, J D McIninch.
на mac существует определенное расширение для выполнения shell
скрипты, дважды щелкнув по ним: это .command .
Источник
Equivalent of .bat in mac os
I currently use a .bat file that is utilized to invoke a java file. If I wanted to utilize the same functionality on Mac OS what format changes would I make? (unless the .bat equivalent on Mac OS is the .sh format?)
Any assistance would be appreciated.
3 Answers 3
Usually you can create bash script for Mac OS, where you put similar commands as in batch file. For your case create bash file and put same command, but change back-slashes with regular ones.
Your file will look something like:
Change folders in path above to relevant one.
Then make this script executable: open terminal and navigate to folder with your script. Then change read-write-execute rights for this file running command:
Then you can run it like any other regular script: ./scriptname.sh
or you can run it passing file to bash:
The common convention would be to put it in a .sh file that looks like this —
Note that ‘\’ become ‘/’.
You could execute as
or set the x bit on the file
and then just call
I found some useful information in a forum page, quoted below.
From this, mainly the sentences in bold formatting, my answer is:
Make a bash (shell) script version of your .bat file (like other
answers, with \ changed to / in file paths). For example:
Then rename it to have the Mac OS file extension .command .
That should make the script run using the Terminal app.
If the app user is going to use a bash script version of the file on Linux
or run it from the command line, they need to add executable rights
(change mode bits) using this command, in the folder that has the file:
The forum page question:
Good day, [. ] I wondering if there are some «simple» rules to write an equivalent
of the Windows (DOS) bat file. I would like just to click on a file and let it run.
Info from some answers after the question:
Write a shell script, and give it the extension «.command». For example:
— Mar 23, 2010, Tony T1.
The DOS .BAT file was an attempt to bring to MS-DOS something like the idea of the UNIX script.
In general, UNIX permits you to make a text file with commands in it and run it by simply flagging
the text file as executable (rather than give it a specific suffix). This is how OS X does it.
However, OS X adds the feature that if you give the file the suffix .command , Finder
will run Terminal.app to execute it (similar to how BAT files work in Windows).
Unlike MS-DOS, however, UNIX (and OS X) permits you to specify what interpreter is used
for the script. An interpreter is a program that reads in text from a file and does something
with it. [. ] In UNIX, you can specify which interpreter to use by making the first line in the
text file one that begins with «#!» followed by the path to the interpreter. For example [. ]
— Mar 23, 2010, J D McIninch.
On mac, there is a specific extension for executing shell
scripts by double clicking them: this is .command .
Источник
Running .bat files on a Mac
How can we run a .bat file on Mac OS X?
Has anyone done it?
4 Answers 4
The equivalent to «batch files» on OS X are «shell scripts» (since OS X is derived from Unix). These are written in much the same way, as a text file with a list of commands to run. For example:
It depends on how complicated your requirements are. The fact that you are even asking this questions implies that you do not have extensive knowledge of Mac so you’ll probably do something simple. If you’re not a unix geek there’ll be a steep learning curve with shell scripts. Have a look at automator and see if it will do what you want. You can read about it on Wikipedia or type «Automator» into that help thingie you find on the mac menubar.
If you must, an effective (but heavyweight) way to run a .bat file on various Unix flavours, including OSX, is with Wine (The WINdows Emulator) : https://www.winehq.org/
Then you can run .bat scripts via: $ wine cmd /c MyScript.bat
Mac OSX is BSD based no? You may be able to use different shell like/emulator like doscmd
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
Question: Q: opening .bat files on my mac
MacBook 2.4 Ghz, 2 gigs ram, integrated graphics, Mac OS X (10.5.5)
Posted on Feb 14, 2009 4:43 PM
All replies
Loading page content
Page content loaded
normally a .bat file is only a ‘text’-file in which a set of instructions is defined that run at the ‘Command Prompt’ of Windows (and Windows only).
Since you are using Crossover and the main application seems to work within Crossover, the .bat file should work as well in Crossover.
Look at the Crossover manual to find out how to run a .bat file in Crossover.
Since neither Applescript nor Terminal nor OSX itself can handle the ‘bottle’ concept of Crossover, trying to translate a .bat file or using it outside of Crossover won’t work.
Feb 15, 2009 4:36 AM
Like you said, the batch file is only text file, therefore Crossover does not recognize it. I know that if i re-wrote the entire file in Applescript, it would probably work, but i have absolutely no idea how to do that.
Terminal seemed to work, but when i told it to execute, it said that I did not have the permission to do so, even though I am the root administrator. I selected the bat file and went file> get info to change the permission, but it said i could only read and write, not execute it. Does this mean that I cannot use terminal to open this?
Feb 15, 2009 6:06 AM
Terminal seemed to work, but when i told it to execute, it said that I did not have the permission to do so, even though I am the root administrator. I selected the bat file and went file> get info to change the permission, but it said i could only read and write, not execute it. Does this mean that I cannot use terminal to open this?
Terminal refuses to execute the file as a precaution, since it can not execute the instructions included in the file.
Read+Write only means that you can ‘edit’ the text file, but Terminal (and OSX) have no way to execute the Windows System Calls in it.
I have Crossover lying around since the LameDuck day but haven’t had the time to ‘play’ with it.
As said you have to execute the batch file while you are in Crossover Windows, so maybe when you import/copy the .bat file into Crossover when running it should enable you to run the file (using the Windows Command Prompt for example).
Источник