Startup script using PowerShell

Gradle 2.4 addresses startup script generation problem via pluggable script generator.

But 2.4 solves the problem partially. There is no easy way to change the output file extension (seems to be hardcoded to .bat)

Continuing the discussion from How to generate the startup-script in Windows PowerShell?:

1 Like

That’s correct. The generated script file name cannot be modified (yet). Would you be interested in contributing the functionality?

As a workaround you could rename the file after generating it:

startScripts.doLast {
    // rename file by referencing startScripts.windowsScript

Gradle should generate two scripts on Windows out of the box: both the batch file and the PowerShell script. (This should be easy as the script has already been written by Masashi.) Then there is no need to be able to set the name of the script (but this can still be added as a feature of course).

If the standard start scripts do not suffice for your situation you could still change them of course:

// Same name for the batch file for backwards compatibility.
startScripts.windowsStartScriptGenerator.template = ...
startScripts.windowsStartPowershellScriptGenerator.template = ...

A pull request would help move forward this functionality. We’d welcome any contribution from the community on this plugin!