Good alternative to Windows batch scripts?

16,801

Solution 1

If you are interested in developing scripts for Windows than a technology developed specifically for Windows, like the PowerShell, is a sensible choice.

While groovy will probably allow you achieve your goal I don't think there is a particular advantage that it could offer.

Saying that, you have to consider familiarity factor and learning curve. You say developers have experience with Java and Groovy in which case running ant tasks via the groovy DSL can prove easier than learning PowerShell.

Regardless, consider developing your scripts using the TDD approach. Groovy offers plenty of frameworks (try Spock for example) while there are also ways to achieve that for PowerShell.

Solution 2

Powershell, VBScript, Perl, Python. There are no shortages of good scripting languages that have a Windows implementation.

Solution 3

It kind of depends on what you are looking to do with your scripts. BASH on windows via cygwin might be a good thing to try.

Solution 4

You might also wanna look at good old Ant, it has targets for copying, executing shell commands, etc. Gradle might be even better, as it supports inline Groovy code, including easy loops and conditions, which Ant lacks.

Solution 5

PowerShell 2.0 onward is a good choice. It will come along with Windows Server 2008 R2 or windows 7 onward. you don't need to install anything on top of these O/S version.

Share:
16,801
Marcus Leon
Author by

Marcus Leon

Director Clearing Technology, Intercontinental Exchange. Develop the clearing systems that power ICE/NYSE's derivatives markets.

Updated on June 19, 2022

Comments

  • Marcus Leon
    Marcus Leon about 2 years

    What are some good alternatives to Windows batch scripts? We have a number of them and they are very "clunky" to work with. As our group is familiar with Java is Groovy a good option?

    A lot of our scripts are used to prep dev databases so they involve a lot of cd mydir, hg fetch, sqlplus ..., etc..

  • JUST MY correct OPINION
    JUST MY correct OPINION over 13 years
    Cygwin is NEVER a good thing to try. :-O
  • djangofan
    djangofan over 12 years
    TIP: Netbeans IDE has support for Groovy scripting.
  • sbglasius
    sbglasius about 12 years
    I agree, that Gradle is a nice tool for this, but Groovy, using Grapes for dependencies is definetly also nice.
  • Andreas Haferburg
    Andreas Haferburg over 5 years
    I tried Python. When starting a process you have to fiddle with streams, and as soon as you run into Unicode issues you'll find that Python is not the right tool for this job. Batteries not included.