:Listvar
List the scripting variables visible to sqlcmd.
Syntax at a glance
:Listvar
Work example
Check the settings in a lab template
Use :Setvar to set a harmless lab variable and then enter :Listvar.
Check your work The lab variable is listed with its expected value. Keep secrets out of variables you need to display.
Open Microsoft Learn for full syntax, permissions, and details for your version.