使用Windows批处理命令循环直到文件存在
发布时间:2020-12-13 22:31:02 所属栏目:Windows 来源:网络整理
导读:如何将以下代码转换为 Windows批处理命令? 这是一个perl脚本,它在while循环中搜索文件,如果发现它退出. use strict;use warnings;my $filename = 'something.txt'; while (1) {if (-e $filename) {print "File Exists!"; exit; }} 解决方法 这是一个相当直
如何将以下代码转换为
Windows批处理命令?
这是一个perl脚本,它在while循环中搜索文件,如果发现它退出. use strict; use warnings; my $filename = 'something.txt'; while (1) { if (-e $filename) { print "File Exists!"; exit; } } 解决方法
这是一个相当直接的翻译.代码应该是不言自明的:
@ECHO OFF SET LookForFile="C:PathToFile.txt" :CheckForFile IF EXIST %LookForFile% GOTO FoundIt REM If we get here,the file is not found. REM Wait 60 seconds and then recheck. REM If no delay is needed,comment/remove the timeout line. TIMEOUT /T 60 >nul GOTO CheckForFile :FoundIt ECHO Found: %LookForFile% (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- 使用VBScript的剪贴板
- rdp – 不允许使用远程桌面客户端中的RD网关保存
- windows-update – 从Microsoft Update更新的WSU
- windows-phone-8.1 – 如何避免StorageFile.Copy
- windows-phone-7 – 防止Windows Phone中的Pivot
- windows-server-2008 – 基于无风扇闪存的系统上
- windows-service – 无法使用sc命令删除现有服务
- Windows Server 2016-抢占FSMO角色
- 除非管理员首先登录,否则Windows 7将启动经典桌面
- Exp2 后门原理与实践 - 20164304 姜奥
热点阅读