i try to make a loop in a .cmd file.
If test.txt is not exists then i will kill the cmd process.
@echo off
if not exists test.txt goto exit
But this code doesn’t work and i don’t know how to make a loop every 2 seconds.
Thanks for help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The command is called
exist, not exists:About your loop:
I am not 100% sure, but I think there is no sleep or wait command in Windows. You can google for sleep to find some freeware. Another possibility is to use a ping:
EDIT:
The Windows Server 2003 Resource Kit Tools contains a sleep.
See here for more information, too