Link to home
Start Free TrialLog in
Avatar of Ben Hart
Ben HartFlag for United States of America

asked on

Batch syntax question: Check if file exists and if specific text not exists then copy file

So in short I want to do the following:

If exist "%userprofile$\appdata\locallow\sun\java\deployment\deployment.properties"
findstr /m "C\:/Java/exception.sites" "%userprofile$\appdata\locallow\sun\java\deployment\deployment.properties"
if %errorlevel%==0 (
copy \\network\share\file %userprofile%\appdata\locallow\sun\java\deployment

If there is a file named deployment.properties and it contains a string "C\:/Java/exception.sites" then echo 'File Correct', If not exist then copy and overwrite with file from network share and echo 'File wrong, overwritten'
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial