I have a .bat file with the following in it. It deletes a scheduled task named defrag using credentials I provide to it. If I copy this exact line into a command prompt and run it the thing works fine. If I throw it into a batch file and run it that way it loops indefinitely. I was hoping someone could think of some reason this could be going on.
schtasks /delete /F /S \\%computername% /U domain\user /P Password /TN defrag
schtasks /delete /F /S \\%computername% /U domain\user /P Password /TN defrag