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