SQLCMD not executing correctly when using a batch file

I'm trying to backup a small SQL database using task scheduler in Windows 7.  When I run the SQL command that I have created in the command prompt, it runs successfully.  If I try and run that same command in a batch file, the command just executes over and over in the command prompt until you cancel it.  What am I missing?  I am using SQL Server Express 2008.
Who is Participating?
QlemoConnect With a Mentor Batchelor and DeveloperCommented:
Probably you have named the batch file sqlcmd, and so sqlcmd calls itself. You can
a) rename the batch file
b) use sqlcmd.exe in the batch file to make sure the application is run
c) provide the exact path to sqlcmd.exe with the call.
Kevin CrossChief Technology OfficerCommented:

Did you turn the echo off? If not, do so:
@echo off

Open in new window

MSDN: http://msdn.microsoft.com/en-us/library/ms180944.aspx

Let me know if that helps.
Kevin CrossChief Technology OfficerCommented:
Good call Q. I thought the batch was echoing the SQLCMD and so repeating; however, your theory sounds more viable.
bnob99Author Commented:
Thanks for the suggestions.  I've had jury duty all week so I will try the suggestions on Monday.
bnob99Author Commented:
This resolved my problems.  Thanks for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.