![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Can i read the value from a .properties file Hi, I have a abc.properties files. This file has contents as below #local local.db.server = SQL024301 local.db.database = Taurus_Dev_R4 local.db.username = NT #dev dev.db.server = SQL024302 dev.db.database = Taurus_Dev_R4 dev.db.username = NT The above parameters are passed to a stored procedure through the VB script. Can i read the values from the properties file? If so how? Thanks Deepal |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Can i read the value from a .properties file deepal.82@xxxxxx schrieb: Quote: > Hi, > > I have a abc.properties files. > This file has contents as below > > #local > local.db.server = SQL024301 > local.db.database = Taurus_Dev_R4 > local.db.username = NT > #dev > dev.db.server = SQL024302 > dev.db.database = Taurus_Dev_R4 > dev.db.username = NT > > The above parameters are passed to a stored procedure through the VB > script. Can i read the values from the properties file? If so how? > > Thanks > Deepal Dim oFS : Set oFS = CreateObject( "Scripting.FileSystemObject" ) Dim sPFSpec : sPFSpec = ".\abc.properties" Dim dicProps : Set dicProps = CreateObject( "Scripting.Dictionary" ) Dim oTS : Set oTS = oFS.OpenTextFile( sPFSpec ) Dim sSect : sSect = "" Do Until oTS.AtEndOfStream Dim sLine : sLine = Trim( oTS.ReadLine ) If "" <> sLine Then If "#" = Left( sLine, 1 ) Then sSect = sLine WScript.Echo oTS.Line, "starting section", sSect Else If "" = sSect Then WScript.Echo oTS.Line, "no section", sLine Else Dim aParts : aParts = Split( sLine, "=" ) If 1 <> UBound( aParts ) Then WScript.Echo oTS.Line, "bad property line", sLine Else dicProps( sSect & "." & Trim( aParts( 0 ) ) ) = Trim( aParts( 1 ) ) WScript.Echo oTS.Line, "good property line", sSect, sLine End If End If End If End If Loop oTS.Close Dim sKey For Each sKey In dicProps WScript.Echo sKey, "=>", dicProps( sKey ) Next sKey = "#local.local.db.database" WScript.Echo dicProps( sKey ) output: 2 starting section #local 3 good property line #local local.db.server = SQL024301 4 good property line #local local.db.database = Taurus_Dev_R4 5 good property line #local local.db.username = NT 6 starting section #dev 7 good property line #dev dev.db.server = SQL024302 8 good property line #dev dev.db.database = Taurus_Dev_R4 8 good property line #dev dev.db.username = NT #local.local.db.server => SQL024301 #local.local.db.database => Taurus_Dev_R4 #local.local.db.username => NT #dev.dev.db.server => SQL024302 #dev.dev.db.database => Taurus_Dev_R4 #dev.dev.db.username => NT Taurus_Dev_R4 |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Can i read the value from a .properties file Thanks a lot for the reply. I shall try to work on this. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Can i read the value from a .properties file On Aug 20, 5:25*pm, deepal...@xxxxxx wrote: Quote: > Thanks a lot for the reply. I shall try to work on this. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| read-only option in properties cannot be cleared | General Discussion | |||
| File info and properties when you right ckick on a file | Vista file management | |||
| How to read sql server database properties | PowerShell | |||
| Read properties in windows Mail | Vista mail | |||
| Read properties of Windows Service from Windows Forms App | .NET General | |||