I'm doing scripting using appcmd
. What I'd like to do is check to see if a given site exists and if does perform an action. In this case, delete it.
appcmd list app | find "mySite"
So, if the find "mySite" returns any text, I'd like to execute a delete statement. Now, I understand I could attempt to delete the site and ignore the error but that gives a (potentially) confusing output.
I've tried something like the following, where I assume I'd just use the variable appExists
in an if statement, but it just ends up blank. Alayways.
set appExists=appcmd list app | find "mySite"
echo %~n0: %appExists%
How can I achieve this?