我当前正在编写batch-file以执行目录中未知的名为checksum的文件。问题是我不知道如何在目录中搜索.sfv
或.md5
并将找到的校验和文件设置为变量,以后可以在脚本中执行。
@echo off
set quicksfv="%ProgramFiles%\QuickSFV\quicksfv.exe"
if exist "*.sfv" (
goto sfvcheck
)
and (
set EXT="sfv"
)
else (
goto skip
)
if exist "*.md5" (
goto sfvcheck
)
and (
set EXT="md5"
)
else (
goto skip
)
/*
this is what i would like to add if the checksum file exist
*/
GetFileName of checksum file
set CHECKSUM="checksumfilename"
:sfvcheck
quicksfv "%CHECKSUM%.%EXT%"
:skip
echo. No checksum file was found!
pause
exit
我对另一个CRC应用程序执行了此过程,这有点不同。它仅支持SFV,但...
@echo off
set SFVCHECK="C:\dont_alter\pure-sfv.exe"
cd %1
set errorlevel=0
%SFVCHECK% -t -i
if errorlevel 10 (
echo Different CRC or a missing file...
pause
exit /B %errorlevel%
)
if errorlevel 11 (
echo Different CRC...
pause
exit /B %errorlevel%
)
if errorlevel 12 (
echo Missing file...
pause
exit /B %errorlevel%
)
```