例) SET dbName=TestDB SET tableName=TestTable SET filePath=%~dp0TestFile.csv SET instanceName=TestInstance SET userId=sa SET password=Password FOR /F "usebackq" %%r IN (`sqlcmd -Q "IF OBJECT_ID('%dbName%.dbo.%tableName%') IS NULL BEGIN SELECT 0 END ELSE BEGIN SELECT 1 END" -S %instanceName% -U %userId% -P %password%`) DO ( IF %%r EQU 1 ( ECHO ■%dbName%.dbo.%tableName%は存在します ) )