借助《bat 读取 ini 文件》文章中的readini.bat实现(请自行前往下载),可满足多个section下Key值查询。

ini文件示例

[Server]
ServerName =127.0.0.1

读取Server下的ServerName

set section1="Server"
set key1="ServerName"
for /f "delims=" %%a in ('call readini.bat /s section1 /i key1 "ini文件路径"') do ( set test=%%a )

or

for /f "delims=" %%a in ('call readini.bat /s "Server" /i "ServerName" "ini文件路径"') do ( set test=%%a )

  

注意:ini文件编码类型需指定为”ANSI“,否则读取失败

bat ini文件读取的更多相关文章

  1. 【代码】ini 文件读取工具类

    using System; using System.Runtime.InteropServices; using System.Text; namespace hrattendance.Common ...

  2. python向config、ini文件读取写入

    config读取操作 cf = configparser.ConfigParser() # 实例化对象 cf.read(filename) # 读取文件 cf.sections() # 读取secti ...

  3. PHP.ini文件读取不到

    Configuration File (php.ini) Path /usr/local/php/lib Loaded Configuration File (none) Linux 把 dtruss ...

  4. Python中.ini文件使用

    .ini文件 一般用来配置常量或者数据库链接语句等,是纯文本格式,所以可以用纯文本编辑器来编辑其内容. ;文件格式如下 ;注释用分号开头,setion 节 [setion] key = value s ...

  5. C# 如何实现完整的INI文件读写类

    作者: 魔法软糖 日期: 2020-02-27 引言 ************************************* .ini 文件是Initialization File的缩写,即配置文 ...

  6. bat 读取 ini 文件

    bat 读取 ini 文件 参考链接:https://stackoverflow.com/questions/2866117/windows-batch-script-to-read-an-ini-f ...

  7. C#读取ini文件的方法

    最近项目用到ini文件,读取ini文件,方法如下: using System; using System.Collections.Generic; using System.Linq; using S ...

  8. c#读取INI文件

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  9. INI文件的读取(C语言:GetPrivateProfileString/GetPrivateProfileInt)

    INI文件格式说明 /********************************************* ini文件说明 ini文件是文本文件,由节点(Section)和键值对(key=val ...

随机推荐

  1. nodejs http服务器简单搭建

    var http = require('http') // 1. 创建 Server var server = http.createServer() // 2. 监听 request 请求事件,设置 ...

  2. 【leetcode】778. Swim in Rising Water

    题目如下: 解题思路:本题题干中提到了一个非常重要的前提:"You can swim infinite distance in zero time",同时也给了一个干扰条件,那就是 ...

  3. 对webpack的初步研究4

    Mode string module.exports = { mode: 'production' }; webpack --mode=production The following string ...

  4. 数组与List互转的坑

    一.数组转List 非原始类型的数组转List有很多种方式:假设有Integer[] arr = {"a", "b", "c"}; 1.Li ...

  5. php stristr()函数 语法

    php stristr()函数 语法 作用:返回一个字符串在另一个字符串中开始位置到结束的字符串,不区分大小写.直线电机厂家怎么样? 语法:stristr(string,search,before_s ...

  6. 树上倍增 x

    树上倍增. dfs序的做法: 思路: //f[i][j]表示dfs序中序号为i到序号为j的点之间深度最小的点的编号 dfs序[]//存0-...(id)编号 节点[]//存dfs序中所经过的节点号 d ...

  7. 【2019 Multi-University Training Contest 10】

    01: 02: 03:https://www.cnblogs.com/myx12345/p/11671692.html 04: 05:https://www.cnblogs.com/myx12345/ ...

  8. spash和selenium浅析

    Splash是什么: Splash是一个Javascript渲染服务.它是一个实现了HTTP API的轻量级浏览器,Splash是用Python实现的,同时使用Twisted和QT.Twisted(Q ...

  9. flask-script实现自动刷新页面调试

    本文flask==1.0.2 1.导入extension包 from flask_script import Manager 2.使用manager管理工具 app = Flask(__name__) ...

  10. Elasticsearch6.5安装&&常见问题与答案解释

    ElasticSearch是一个用Java开发的基于Lucene的搜索服务器.它可以提供一个分布式多用户能力的全文搜索引擎,基于RESTfulweb接口.现阶段它主要为Apache许可条款下的开放源码 ...