Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there the "Windows Batch file" emulator/interpreter for UNIX? [closed]

Can I run the batch file on UNIX? (Linux / Mac OS X)

I am looking for the interpreter to run the Windows Batch file on UNIX, like 'bash' for bash script, 'csh' for csh script, so 'XXX' for windows batch file.

I am developing a Java application.

  • Development environment is on Mac OS X
  • but target(primary executed) environment is on Windows.
  • The applicaiton uses Windows batch file & executable.
    • it generates *.bat to run the stub program (*.exe).
  • So I want to write Unit-tests and prepare the stub program (*.exe as bash script),
  • and want to run it on Mac OS X - not Windows.
    • but, it does not mean that I want to execute (emulate) Windows binary (*.exe)... I only want to launch *.bat and let it to invoke test stub *.exe made with sh/perl/ruby.

...Any ideas?

(Related to) how i can execute windows batch file from UNIX-AIX?

like image 419
kaorukobo Avatar asked Apr 18 '11 03:04

kaorukobo


2 Answers

cmd.exe is rated NSFW in my area code

On windows look at PowerShell

If you insist, use Wine on linux, Solaris, BSD etc. It comes with cmd.exe :)

Wikipedia on Wine

MacOSX support:

  • http://wiki.winehq.org/MacOSX
  • http://davidbaumgold.com/tutorials/wine-mac/
like image 56
sehe Avatar answered Oct 28 '22 04:10

sehe


No, there isn't such a beast. And, if there is a god, there never will be :-)

While the effort to create a batch file interpreter is moderate to high (especially if you're not using every single feature of cmd.exe), running the executable is so much, much harder.

I would be investigating a solution of starting up a clean Windows virtual machine and running your application under Windows there. You could easily do your unit tests as Windows programs as well so as not to have to worry about driving the VM from OSX.

The only thing you then need to concern yourself with is how to get the results back to OSX from the Windows VM. That should be doable (though kludgy) via network storage (shared drives or NFS or something similar).

like image 40
paxdiablo Avatar answered Oct 28 '22 02:10

paxdiablo