如何将以下代码转换为 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:\Path\To\File.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%
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)