sqlcmd: no rows affected
If you really want to return the number of rows, You need to create a text file A.SQL:

exec dbo.subprogram; 
:EXIT(select @@rowcount)


Because EXIT must be at the beginning of a line, so you can't use -Q. Then you call:

C:\&gt; SQLCMD -S servername -d database -i A.SQL -o A.OUT


Then the returned values by EXIT will be in ERRORLEVEL... You can query with:

C:\&gt; ECHO %ERRORLEVEL%