DAC Connection using the SSMS for executing the code
You should pass in your query according to sqlcmd syntax specifying -Q (or -q or -i for the script file) like this:

EXEC master.dbo.xp_cmdshell 'SQLCMD -S SQLServer -A -d Db1 -Q"select count(*) AS FileCount from TableName" '