如何识别txt文件中的字符串并将其设置为变量 [英] How to recognize string in txt file and set it as variable

查看:72
本文介绍了如何识别txt文件中的字符串并将其设置为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 


我有txt文件,其中的字符串以字符串开头:


数据目录.... :



如何(使用批处理文件)在文本中找到它,读取并将值设置为变量?我的意思是字符串是:


数据目录....:c:\datadir



我的意思是什么价值在这种情况下是"c:\ datatir"。所以我希望批处理文件读取txt文件,找到以"data directory ....:"开头的字符串。然后设置"c:\ datatir""作为变量。 



Best,mac

解决方案

< blockquote>

尝试研究这两个命令"


FOR /?


SET /?



Hi, 

I have txt file and somwhere in it string starting with:

data directory....:

How (using batch file) find it in the text, read and set the value as a variable? I mean the string is:

data directory....: c:\datadir

where what I mean value is  in this case "c:\datadir". So I want batch file to read the txt file, find string starting with "data directory....:" and then set "c:\datadir" as a variable. 

Best, mac

解决方案

Try studying these two commands"

FOR /?

SET /?


这篇关于如何识别txt文件中的字符串并将其设置为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆