I have this command that scan a file and returns a summary.
For example on running this command
omsCmdLineUtil.exe process C:\test.exe Default
the result output is:
Ticket:[ 2214271306 ]
Process Details
---------------
File: [ C:\test.exe ]
   MD5: [ D41D8CD98F00B204E9800998ECF8427E ]
   SHA1: [ DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 ]
   SHA256: [ E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 ]
   File Size: [ 0 bytes ]
   File Type  Category: [ O ]
   File Type: [ - ]
   File Type Description: [ empty ]
[ Clean ] Ahnlab scan engine [ 1 ms ]
[ Clean ] ClamAV scan engine [ 1 ms ]
[ Clean ] BitDefender scan engine [ 1 ms ]
[ Clean ] Avira scan engine [ 1 ms ]
[ Clean ] Quick Heal scan engine [ 1 ms ]
[ Clean ] ThreatTrack scan engine [ 1 ms ]
[ Clean ] ESET scan engine [ 1 ms ]
[ Clean ] Total Defense scan engine [ 1 ms ]
Scan Completion
---------------
        [ Clean ]
        Ticket: [ 2214271306 ]
        File path: C:\test.exe
        Scan time: 1 ms [12/20/2015 13:00:06:791]
Process Completion
------------------
        Ticket: [ 2214271306 ]
        User agent: Default
        Profile: Default
        Result: [ Allowed ]
        File processed: C:\test.exe
I want to create a batch file that parses this result by searching for the output line Result:, check if it's [ Allowed ] or [ Blocked ] and return 0 for allowed and 1 for blocked.
I tried something like this, but its not really working:
omsCmdLineUtil.exe process C:\test.exe Default | set ts = findstr /C:"Result: [ Allowed ]"
if %ts% == "Result: [ Allowed ]" return 0
else return 1
Which modification on code is necessary to get the expected result?



%ts%. You produced one with the Name%ts %. Be carefull with spaces in Batch.