Ben Hart
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\loc allow\sun\ java\deplo yment\depl oyment.pro perties"
findstr /m "C\:/Java/exception.sites" "%userprofile$\appdata\loc allow\sun\ java\deplo yment\depl oyment.pro perties"
if %errorlevel%==0 (
copy \\network\share\file %userprofile%\appdata\loca llow\sun\j ava\deploy ment
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'
If exist "%userprofile$\appdata\loc
findstr /m "C\:/Java/exception.sites"
if %errorlevel%==0 (
copy \\network\share\file %userprofile%\appdata\loca
If there is a file named deployment.properties and it contains a string "C\:/Java/exception.sites"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.