i want to read a below property file and get the particular key value
My properties file look like
name=arulraj.net
version=1.0.2
date=24/March/2010
I want get the version from the properties file. you can do this by various method.
Using Type function:
C:\Users\Arul\Desktop>type test.properties | find “version”
There is disadvantage with this method you could not store that value in a variable.
Using For Loop:
C:\Users\Arul\Desktop>FOR /F %i IN (test.properties) DO echo %i
using this command you can read that file by line by line.
FOR /F “eol=; tokens=2,2 delims==” %i IN (test.properties) DO echo %i
Using this commend you can get the values only.
eol is End of Line
tokens is specify the which tokens are displayed – 2,2 means only the second token will be displayed
delims is the deliminator . this is the separator
FOR /F "eol=; tokens=2,2 delims==" %i IN ('findstr /i "version" test.properties') DO set version=%i
Using findstr get the correct string from the properties file and give as a input to the for loop. That for loop process the result and set that value to the variable version.
findstr /i means is not a case sensitive one
using echo you can get the value.
echo %version%
When you using in a bat add a % befor %i. That is Look like
FOR /F "eol=; tokens=2,2 delims==" %%i IN ('findstr /i "version" test.properties') DO set version=%%i
echo %version%
分享到:
相关推荐
- 属性配置文件 (.properties): 9个 - Git忽略文件 (.gitignore): 3个 - INI配置文件 (.ini): 2个 - 许可证文件 (LICENSE): 1个 - Markdown文档 (.md): 1个 - 工厂配置文件 (factories): 1个 - YAML配置文件 (.yml):...
jmeter.properties 系统配置文件(内存、字符编码、日志级别等设置都在该文件) jmeter-server.bat windows分布式测试要用到的服务器配置 jmeters-server linux分布式测试要用的服务器配置 其中系统配置文件中的SSL...
包含drools Workbench安装所需的jar包,配置文件,resources.properties、btm-config.properties、setenv.bat、setenv.sh
下载文件: 运行jersey-server, 不设置端口的情况下,默认为8080,springboot jar运行方式下默认端口为9000 ...文件路径分割符号请用/替代\...上传下载文件大小在工程jersey-server的配置文件application.properties里设置
application.properties 配置如下 #静态文件配置 spring.webflux.static-path-pattern =classpath:/static/** #数据库配置 #spring.datasource.url =jdbc:mysql://localhost:3306/springboot?serverTimezone...
兼容安装的是exe的tomcat和安装的tomcat压缩包,旧项目的备份,新项目部署到tomcat,替换application.properties(mongodb的配置),config.properties(上行的接口调用),jdbc.properties(数据库的配置)
不好意思,以前的配置有点问题,现在重新上传,有问题请回复 以我安装路径为例, E:\nokia\Carbide.c++ v2.0 1.... 将补丁文件直接覆盖... run_env_update.bat 这四个文件外其他的文件全部删除 4 重启carbide c++, ok
java 程序使用redis + windows服务端 1.点击 /redis服务端/hcredis.bat 启动服务端 2.把jar导入到项目里面 ...3.把配置文件 redis.properties 导入 src下 4.JedisUtil.java 里面提供了缓存的添加 删除
(1)批处理命令bat文件: (2)build.xml文件、 (3)user.properties、jmeterxml.properties、jmetercsv.properties文件。 (4)配置说明文档博客地址:...
Java根据关键词爬取视觉中国图片jar包,下载后直接通过修改配置文件clawer.properties中的数据,点击start.bat文件直接运行即可下载图片。
可以运行的androidpn服务器代码和客户端代码,服务器代码直接解压然后找到bin目录下面的run.bat文件双击运行即可,客户端的代码直接导入eclipse,改下raw/androidpn.properties里面的: apiKey=1234567890 xmppHost...
开发环境使用application-dev,生产环境使用application-pro,生产环境需要重新配置文件目录地址 #### 4、提供的账号 普通用户:aaa 密码:123456 无权限 版主:bbb 密码:123456 置顶、加精权限 管理员:ccc ...
本系统模拟了三个tomcat,如需增加或者修改tomcat,可以在Apache目录的conf目录下的workers.properties进行配置。 #server worker.list = controller #========tomcat1======== worker.tomcat1.port=11009 ...
解决文档管理痛点 不满足swagger文档预览页面和调试页面的展现方式 不喜欢swagger这种侵入式注解 ...打开application.properties配置文件,修改数据库连接配置 执行sh startup.sh启动(Windows执行startup.bat)
2.配置config.properties配置文件,内容如下 配置 说明 qq.account = 你的QQ账号 qq.password = 该账号的密码 qq.admin = 管理员的QQ号 daily.english = 金山词霸每日一句链接,而不使用修改 3.启动大米 Windows:...
Gradle项目群所有项目共用gradlew目录下的配置文件和批处理脚本。一、gradlew\g.bat会自动设置环境变量和Path:1、设置GRALE_HOME用户环境变量为gradlew目录;2、设置GRADLE_USER_HOME用户环境变量为gradlew.gradle;...
该文件必须在矿工目录中(与'*.jar'文件相同的文件夹) 首先,请使用以下示例之一。 分钟。 不同挖掘模式所需的设置。 池设置 plotPaths=D:/,C:/,E:/plots,F:/plots numericAccountId= poolServer=...
1.程序为定时任务,任务执行时间在bin目录下的配置文件mergeFilleUtil.properties中配置,在配置文件中,TASK_PERIOD表示任务执行时间间隔,单位为妙,如一天的时间间隔配置是86400,TASK_BEGIN_HOUR表示任务开始的...
2、修改launcher目录下launcher.properties配置文件 main代表Main-Class 路径,如:test.Test classpath指定Class-Path路径,可以多个,用:分割,如:classes libraries指定jar包所在目录,可以多个,用:分割如:lib ...