Live data from Hacker News

Batsh – A language that compiles to Bash and Windows Batch

batsh.org

21–30 of 130 posts

Re: Batsh – A language that compiles to Bash and Windows Batch

#22

This is great for me. As part of my day job I am often stuck writing batch scripts (yes, in 2014) for clients that refuse to run powershell. Writing a simple batch script is usually not a problem, but it can be very encumbering as the complexity increases. Thank you for sharing.

I want to agree, but my major gripe using the different incantantions of Powershell (and I have tried, I am Winboxen admin often in my job and tried it before any other co-worker on Vista, obviously the story has improved since) and the startup time and performance was abysmal.

In terms of performance for very basic scripts (silent software installs, 5-10 lines, registry patching, etc.), I see the performance chart as:

Batch > VBScript > Powershell

in terms of speed. I wish I had tried Jscript, because the ironic Javascript is taking over the world could have meant retro hipster superiority (and scary you could integrate JScript and VBScript into the same script by embedding them in XML type directives and using the WSF system). Now that was scarier than any of this.

As an aside, outside of speed, how do you sign scripts for clients? I love that Powershell encouraged it, but every person I have met has not bought into Powershell, and most certainly invokes "disable the cert check" completely command for all executed Powershell scripts.

Re: Batsh – A language that compiles to Bash and Windows Batch

#23
post #5

I would have preferred a bash/powershell solution. Hoping no one is still writing batch files on windows... even if he is still using xp

Agreed. Powershell has almost completely replaced batch scripts, and is actually a fairly pleasant language to work with.

As I said in the other threads, the language is great, the performance has been abysmal in relation to batch (at least for me, having started with Powershell in its first release in Vista).

Re: Batsh – A language that compiles to Bash and Windows Batch

#25

Love the idea of writing bash in a higher, easier to read format, similar to CoffeeScript. Unfortunately Batsh is written in OCaml (the author addresses why he uses it though). How do you use pipes in batsh?

I reckon you don't, because it's not supported in windows batch. Just googled it. Doesn't seem to be supported yet: https://github.com/BYVoid/Batsh/issues/17

I reckon you don't, because it's not supported in windows batch.

Sure it is: http://www.microsoft.com/resources/documentation/windows/xp/...

Re: Batsh – A language that compiles to Bash and Windows Batch

#27
I had to do this once to avoid having to duplicate a bunch of build and install logic (that couldn't assume some other scripting language was installed), but because of how limited batch is (powershell was not available at the time), I opted to write a simpler DSL that output one or the other. I could see this project developing in that niche by maybe providing more substantial built-in functions for common build/install script functionality.

Re: Batsh – A language that compiles to Bash and Windows Batch

#28
post #5

I would have preferred a bash/powershell solution. Hoping no one is still writing batch files on windows... even if he is still using xp

Totally agree. Powershell is what you need to use on windows. It's been available on the default server install since 2008 R2. No need for batch scripts anymore.

This sounds like you're saying that it suits your needs, therefore we should take that as meaning it fits our needs. Unfortunately, things are not that simple.

I needed to do something and looked at using powershell, but in the end I couldn't just distribute it and have it work for whomever would be using my project. It needed to be signed or something. On the contrary, the bat script I wrote just worked and would just work for anyone who used the project.

Powershell is not a magical solution that suits everyone's needs. This kind of blanket statement helps no-one.

Post reply on HN