Jump to content

How to run cross-platform script on CDROM that works in both windows and OSX?


haze1434
 Share

Recommended Posts

Hi all,

I'm looking at making a script on a CD-ROM, that will;

  1. recognise the operating system of the machine it has been inserted in to
  2. run a specific script for that operating system

Is there a cross-platform script/code language that would be recognised by both Windows and OSX, as a standard build?

I understand that Python, for example, could run on both, however this would require the user to have installed it. Is there a language that both OSX and Windows would recognise straight-out-of-the-box?

I tried a few internet searches, but everything I find pretty much states you have to download additional files to the PC (e.g; installing Python), which is no good.

Thank you.

Link to comment
Share on other sites

I know a really ugly way to do this, it kinda works but is going to throw some errors in the process. you create a .bat file like auto.bat:

#/bin/sh
goto label0
./MacOSX_program
exit 0
label0:
.\Windows_program.exe

The windows OS will see that the filename has a .bat extension. I doesn't know what #/bin/sh means so it throws an error, but continues on. It follows the goto the label0 and then runs the Windows_program.exe.

The mac OS will ignore the .bat extension, but read #/bin/sh as a shell script. it will error on the goto, but continue on to run the MacOSX_program

Link to comment
Share on other sites

On ‎03‎/‎07‎/‎2016 at 6:15 PM, fugu said:

I know a really ugly way to do this, it kinda works but is going to throw some errors in the process. you create a .bat file like auto.bat:


#/bin/sh
goto label0
./MacOSX_program
exit 0
label0:
.\Windows_program.exe

The windows OS will see that the filename has a .bat extension. I doesn't know what #/bin/sh means so it throws an error, but continues on. It follows the goto the label0 and then runs the Windows_program.exe.

The mac OS will ignore the .bat extension, but read #/bin/sh as a shell script. it will error on the goto, but continue on to run the MacOSX_program

Interesting workaround, thank you. I'll have to have a play with this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...