开发者

How to make a Windows batch file exit when a file exists in the file structure?

开发者 https://www.devze.com 2022-12-26 02:35 出处:网络
I want to make something like this... :LoopBegin if ???? goto End some other work goes here* gotoLoopBegin

I want to make something like this...

:LoopBegin

if ???? goto End

some other work goes here*

gotoLoopBegin

:End

The "????" part should be a check that a file exists with the name "exit.txt" for example. If such a file exists in the current folder, I want the batch file to just exit. I开发者_如何学Gos there a way to do this?

Thanks


if exist filename goto End

See if /? from a command prompt for more details of what is possible. Also notice goto :EOF will always goto the end, without needing an explicit label.

0

精彩评论

暂无评论...
验证码 换一张
取 消