-1

I have to Install/Uninstall some products with batch scripts and also use log files to check if Installed or Uninstalled...

So if a product is installed correctly I have somewhere in my log file a line like this one (without quotes):

"SOMETEXT Windows Installer a installé le produit. SOMETEXT"

I would like to detect if (without quotes) "Windows Installer a installé le produit." is present in my file...

I tried a lot of things like :

  • regex "^.Windows[ ]Installer[ ]a[ ]install,[ ]le[ ]produit.$" (Didn't Match)

  • trim each line and tried to findstr "WindowsInstallerainstall,leproduit" (Didn't work)

So I hope you'll give me one solution because, I'm looking for one for 3 weeks...

Thanks

1 Answers1

0

A batch line like

findstr /i /L /c:"Windows Installer a installé le produit." "yourlogfilename"

should find that line, but without a relevant sample, it's not possible to test.

findstr /i /L /c:"Windows Installer a installé le produit." "yourlogfilename" >nul
if errorlevel 1 (echo NOT found) else (echo found)

should set errorlevel to zero if found, non-zero otherwise - and you should be able to extend the match-string to include SOMETEXT if required.

OR you may try a regex (within findstr's restricted implementation) by using

findstr /i /R /c:".*Windows Installer a install.le produit.*" "yourlogfilename" >nul
Magoo
  • 77,302
  • 8
  • 62
  • 84