Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wrongfully looping batch 1

Status
Not open for further replies.

wiimike

IS-IT--Management
Mar 30, 2007
145
US
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

 
I'm going to guess that your batch file is named "schtasks.bat". So, it is calling itself rather than calling schtasks.exe.

If this is true, just rename the batch file and it should work.
 
Thank you! That was EXACTLY my issue. I have a patch of hair left thanks to your help =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top