質問

Through windows batch file, I am trying to -

a. open a folder > open latest '.hl7. file (by date) in the folder.

b. search a specific value in the file. e.g value of the key 'name'

c. echo the value.

I am new to scripting, Can anybody help me write a script for the same?

役に立ちましたか?

解決

I am not sure about the format of the HL7 files but this will get the most latest HL7 file into env variable MyFile and then print the lines in the file that have "name" in them.

@set MyFile=
@for /F %%I in ('dir /od /b *.hl7') do set MyFile=%%I

@if defined MyFile find "name" %MyFile%

If HL7 has many different formats you may be better off writing a program that uses an HL7 library to parse your file.

I hope this helps you get started.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top