Batch -> Bash / Bash -> Batch?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Batch -> Bash / Bash -> Batch?

#1 Post by nitt » 04 Jun 2011 01:17

Is it possible to run or convert between Bash and Batch files?

I tried BASH.EXE, but it isn't that good. My Bash scripts won't work for that. It has something to do with the fact that it doesn't convert "if [ "$move" == "1" ]; then" correctly.

I'm just wondering because sometimes when I'm on Linux I use Bash, sometimes when I'm on Windows I use Batch, and I'd like to have a way to go between my codes without booting in the other operating system.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Batch -> Bash / Bash -> Batch?

#2 Post by Ed Dyreen » 04 Jun 2011 04:11

°
Certainly not for complex batch scripts, it would have to know every trick which can be used in both languages.
I wanted to do something similar once, converting batch to 4DOS, &failed miserably :x

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Batch -> Bash / Bash -> Batch?

#3 Post by dbenham » 04 Jun 2011 07:23

Why convert when you can run bash scripts within Windows? win-bash This is a very light weight port.

For a full blown Unix environment running within Windows, try one of the systems found here: Shell clones within Windows. I had a great experience with AT&T UWIN on my XP system. Unfortunately I haven't gotten it to work on Vista, though I have seen reports that others have succeeded.

Dave Benham

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: Batch -> Bash / Bash -> Batch?

#4 Post by nitt » 04 Jun 2011 11:37

dbenham wrote:Why convert when you can run bash scripts within Windows? win-bash This is a very light weight port.

For a full blown Unix environment running within Windows, try one of the systems found here: Shell clones within Windows. I had a great experience with AT&T UWIN on my XP system. Unfortunately I haven't gotten it to work on Vista, though I have seen reports that others have succeeded.

Dave Benham


BASH.EXE is Win-Bash. Win-Bash doesn't work. It can't even run my basic scripts. :<

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Batch -> Bash / Bash -> Batch?

#5 Post by dbenham » 04 Jun 2011 11:51

Ahh, sorry, I missed that (obviously).

I heartily recommend UWIN if you can get it to install. It is a true port of the Korn shell that is fully integrated with Windows. I think there is a bash shell available for it is well. If you have XP you should be set. If Vista or beyond, I'm not sure.

Dave

Post Reply