Computing Staff
  • 17

Read A .Properties File In Batch

  • 17

I have a properties file (my.File.properties) that contains the lines

my.webSphere.directory=
my.webSphere.profile=

The user will fill those parameter say


my.webSphere.directory=D:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin
my.webSphere.profile=AppSrv01

Now, I want to create a batch file that gets the parameter my.webSphere.directory and my.webSphere.profile from my.File.properties

Thanks!!!

Share

1 Answer

  1. @echo off
    for /F “delims=” %%j in (‘type “my.File.properties”‘) do set %%j
    set my.webShere

    And now… beware the environment variables the batch sets up are not persistent, i.e. they vanish at batch’s end.

    • 0