# Using a different template for generating scripts

**URL:** <https://discuss.gradle.org/t/using-a-different-template-for-generating-scripts/37661>\
**Category:** Help/Discuss\
**Created:** [September 20, 2020, 1:28pm UTC](https://discuss.gradle.org/t/using-a-different-template-for-generating-scripts/37661 "2020-09-20T13:28:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schalk\_Cronje](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/schalk_cronje/32/6511_2.png) [@Schalk\_Cronje](https://discuss.gradle.org/u/Schalk_Cronje)\
**Post date:** [September 20, 2020, 1:28pm UTC](https://discuss.gradle.org/t/using-a-different-template-for-generating-scripts/37661/1 "2020-09-20T13:28:31Z")

</div>

Overriding the templates used for generating start scripts for `application` plugin is ugly

```gradle
    (unixStartScriptGenerator as TemplateBasedScriptGenerator).template = project.resources.text.fromFile(file("path/to/my/file.sh"))
    (windowsStartScriptGenerator as TemplateBasedScriptGenerator).template = project.resources.text.fromFile(file("path/to/my/file.bat"))

```

(Groovy DSL is not much better either).

Is there any better way to write this?
