How do I make a batch file terminate upon encountering an error?

Check the errorlevel in an if statement, and then exit /b (exit the batch file only, not the entire cmd.exe process) for values other than 0. same-executable-over-and-over.exe /with different “parameters” if %errorlevel% neq 0 exit /b %errorlevel% If you want the value of the errorlevel to propagate outside of your batch file if %errorlevel% neq … Read more

How to sleep for five seconds in a batch file/cmd [duplicate]

I’m very surprised no one has mentioned: C:\> timeout 5 N.B. Please note however (thanks Dan!) that timeout 5 means: Sleep anywhere between 4 and 5 seconds This can be verified empirically by putting the following into a batch file, running it repeatedly and calculating the time differences between the first and second echos: @echo … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)