mardi 6 mars 2018

How to use if in batch with commands

I'm still working on that little tool I've started ages ago and I just thought about changing the last bit completely but I have no idea if it's possible to use the if then else in batch how I want it to.

I thought about something like this

if (type <Filepath> | findstr /c:"Mozilla Firefox" OR type <Filepath> | findstr /c:"Mozilla Firefox 2" ) then (
Echo "Mozilla Firefox" >> <Filepath2>
) else (
Echo "No Firefox found"
)

Problem is, that I really have no idea if it's possible to do it like this or if there is a similar ways of doing it. The above is only an excample of what I would like to use.

Aucun commentaire:

Enregistrer un commentaire