I would like to create sqlcmd scripts that:
1) have $(variables) so I can control behavior at runtime, and
2) can also work without any specifying any variable values by -v or environment variables.
The :setvar command can ensure that value-assigned variables exist, but there is no ability to assign runtime values because the :setvar command has the highest precedent.
It would be nice if there was a new sqlcmd command, e.g., :defaultvar, that had a precedence lower than "System-level environmental variables." This way a script would always have its variables defined, AND they could also always be overridden at run time.
This also has the benefit of not altering the behavior of the :setvar command as proposed in this connect thread:
"In Sqlcmd scripts setvar should have a lower precedence than command line variable assignment" (ID = 382007)