开发者

set a variable to a line within a text file containing a known value?

I'm having problems trying to create a batch script that will search through a txt file in a directory for a value "drawing_revision" and then take the line from this and extract the revision and set it as a variable I can use as a prefix on file names.

DRAWING_REVISION 00 TYPE: String

Has anyone d开发者_如何学Goone anything like this before? there doesn't seem to be much on using the line within the text file as a variable rather than the file name.

Thanks

Dave


You could try a FOR-LOOP

for /F "usebackq tokens=2" %%a IN (`findstr DRAWING_REVISION myfile.txt`) do (
  echo Draw-Rev = %%a
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜