Posted on: 4/29/2012 11:56:45 AM | Views : 420

Hi All: in server 2008 R2, I have a simple sqlcmd to back up my sqlexpress dBs that runs properly from the command line:
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd" /S .\SQLEXPRESS /E /Q "EXEC sp_BackupDatabases @backupLocation='c:\tempStuff\', @backupType='F'"
I'm trying to convert this to a batch script so that I can run it using task scheduler, but it seems like I need to escape certain characters or I get """ is not recognized as an internal or external command..."
I tried escaping the quote marks, like this:
^"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd^" /S .\SQLEXPRESS /E /Q ^"EXEC sp_BackupDatabases @backupLocation='c:\tempStuff\', @backupType='F'^"
but when I test running the batch, cmd.exe just consumes 100% of CPU and doesn't seem to execute the actual commands. Is there any way to debug the batch file so I know what the proper synta ...

Go to the complete details ...