我有一个位于%ilmhome%\webapp\WEB-INF\amhome.properties
#Tue Feb 15 19:27:14 IST 2011
amhome.connection.password=amhome534
amhome.connection.url=jdbc\:oracle\:thin\:@(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=diablo)(PORT\=1521)))(CONNECT_DATA\=(SERVER\=DEDICATED)(SERVICE_NAME\=orcl)))
amhome.connection.maxWait=20000
amhome.connection.username=amhome534
amhome.connection.platformId=6
amhome.connection.driver_class=oracle.jdbc.driver.OracleDriver
我想将amhome.properties文件中的以下项目提取到一些变量中
Username : amhome534
Host : diablo
Port : 1521
ServiceName : orcl
ConnString : jdbc\:oracle\:thin\:@(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=diablo)(PORT\=1521)))(CONNECT_DATA\=(SERVER\=DEDICATED)(SERVICE_NAME\=orcl)))
我该怎么做?
答案 0 :(得分:1)
查看FOR /F command ...您应该可以设置DELIMS=.=
和TOKENS=3,*
,这会跳过'amhome'和'connection',但会为您提供像'password'这样的值对+'amhome534'。