Tech Support > Operating Systems > UNIX / Variants > Converting unix shell scripts to dos batch files
Converting unix shell scripts to dos batch files
Posted by Nikolaos Giannopoulos on July 10th, 2003


Anyone know of a tool or site that converts unix (bourne) shell scripts
to dos batch files (for NT/2000/XP)?

Thanks,

--Nikolaos

Posted by Michael Heiming on July 10th, 2003


phn@icke-reklam.ipsec.nu wrote:
He, I was going to say that...


AFAIR "cygwin", but I wouldn't waste my time with it, option 1 is for sure
the easier way.

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

Posted by Chuck Dillon on July 10th, 2003


Nikolaos Giannopoulos wrote:
Do you really want DOS or do you want something that will run in the
native NT/2K/XP shell? They are not the same thing. I'll assume the
latter. If such a thing exists it would be from a Winders centric
source. So you might try asking in ms-windows centric forums about
such a tool. Which you may have already done.

The best solution I know of is to install a pseudo-UNIX environment on
the Winders box. One that may be able to interpret the script as is.
The script may well need to be tweaked but not completely re-written.

Two free options are U/Win from
http://www.research.att.com/sw/tools/uwin/. It comes with ksh, sh and
tcsh. I use it for scripting on my Win2k box at work. The other is
cygwin from cygwin.com. It has a similar capability.

These packages come with core UNIX commandline programs ported to
Winders. So if you script uses 'cp' they provide a 'cp' that will do
what the script expects. No need to map cp calls to copy calls.

There are also commercial solutions from folks like mks.com and
microsoft.com.

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.


Posted by Nikolaos Giannopoulos on July 11th, 2003


Chuck Dillon wrote:
What I want is a tool that would take a first cut at reading in a shell
script and producing a dos batch file equivalent - I don't mind cleaning
it up thereafter.

We have a Java app that makes calls to shell scripts for
pre/post-installation of our product on Solaris and Linux.

We need to have DOS batch file equivalents for our NT/2000/XP installs.

Unfortunately we don't control the target box so we can't use
interpreters (nor would we want to as they are only required for
installation).


I have asked in c.o.msdos.programmer and I'm hearing its impossible
though our shell scripts do not use really advanced commands.

I have also come accross this:
http://www.tldp.org/LDP/abs/html/dosbatch.html

And for a Dos to Unix script check out:
http://garbo.uwasa.fi/pc/batchutil.html
Specifically: batcsh10.zip 28440 Jan 12 1994
Convert MS-DOS batches to Unix csh scripts, fw, B.Pierpoint

Which gives some hope so I guess I'll keep looking. Thanks.

--Nikolaos


Posted by Nikolaos Giannopoulos on July 11th, 2003


phn@icke-reklam.ipsec.nu wrote:
Interpreters won't unfortunately work as I replied in another post on
this thread ;-) Thanks for the idea though.

It depends what one requires I guess - I'm not looking for the full
breadth of shell commands.

Thanks,

--Nikolaos


Posted by Tim Slattery on July 11th, 2003


Nikolaos Giannopoulos <nikolaos@solmar.ca> wrote:

IMHO the WinNT/WinXP batch language is so far inferior to *any* *NIX
shell scripting language that there's just no way to do it. Again
IHMO, you'd be far better off trying to run the *NIX shell scripts
using Cygwin or U/Win as Chuck Dillon suggested.

--
Tim Slattery
Slattery_T@bls.gov

Posted by Chris F.A. Johnson on July 11th, 2003


On Thu, 10 Jul 2003 at 00:00 GMT, Nikolaos Giannopoulos wrote:
That's like asking for something to convert CDs to play on your
1950's HiFi.

Short of installing a UNIX shell on the Windows box, the best
alternative is to convert the script to C (I remember seeing tools
to do that) and compiling it for Windows.

--
Chris F.A. Johnson http://cfaj.freeshell.org
================================================== =================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License


Similar Posts