Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Read the content of a properties file

$
0
0

I have a properties file(.properties), which has contents in this format:-

[1]TYPE=4
[1]ENABLED=TRUE
[1]Caption = "Kozos"
[1]URL=https://kozos.com/access

I want to display the value of url for kozos and when i try below code, i get an error :- 

ConvertFrom-StringData : Data line 'D:\kozos.properties' is not in 'name=value' format. 

Clear-host
$FileName = "D:\kozos.properties"
$file_content = $FileName -join [Environment]::NewLine
$configuration = ConvertFrom-StringData($file_content)
$environment = $configuration.'kozos'
Write-host "Environment is $environment"



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>