Search code examples
powershellgroovyjenkins-pipeline

Create .Properties file using powershell with data in it


How to create a new .properties file using powershell with below data name it as vars.properties 
username=abcd
buildnumber=1234
isSuccess=true    

Is there any way to create with this data in vars.properties file. Later I want use this file in Groovy to extract the data easily.

Appreciate your help.


Solution

  • I am not completely sure about your query.

    But if you want to use PowerShell to create a vars.properties file and push those values in the file.

    You can just execute the following commands in PowerShell

    New-Item vars.properties -ItemType File
    Add-Content vars.properties "username=abcd"
    Add-Content vars.properties "buildnumber=1234"
    Add-Content vars.properties "isSuccess=true"