• I'm not sure if a temp table is the correct way to go in this case. It will be removed immediately after your batch file disconnects from database.

    I would use a state-full table. Here a little sample how to call SQLCMD to create a table and insert "dir C:\"

    sqlcmd -S .\Sql2k8 -E -Q "CREATE TABLE MyCmd (Line VARCHAR(512)) INSERT INTO MyCmd EXECUTE xp_cmdshell 'dir C:\'" -d Sandbox