Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 正在尝试为校验和文件创建验证过程_Batch File_File Io_Windows 7 - Fatal编程技术网

Batch file 正在尝试为校验和文件创建验证过程

Batch file 正在尝试为校验和文件创建验证过程,batch-file,file-io,windows-7,Batch File,File Io,Windows 7,我在网络上的两个不同位置有两个校验和文件,我需要验证它们是否相互匹配,如果不匹配,则输出**未验证**。所以需要做的是,我需要一次一个地将两个文件读入一个变量,然后相互检查变量以进行验证 我所尝试的: :verify_integrity set "verf_integrity_src_file=\\ROCIO-148084\c$\Users\z-perkins-thomas\Documents\bin\batch\verf" set "verf_integrity_dst_fil

我在网络上的两个不同位置有两个校验和文件,我需要验证它们是否相互匹配,如果不匹配,则输出**未验证**。所以需要做的是,我需要一次一个地将两个文件读入一个变量,然后相互检查变量以进行验证

我所尝试的:

:verify_integrity
    set "verf_integrity_src_file=\\ROCIO-148084\c$\Users\z-perkins-thomas\Documents\bin\batch\verf"
    set "verf_integrity_dst_file=%cd%\docs\checksum.md5"
    pushd "%verf_integrity_src_file%"
    setlocal enabledelayedexpansion
    set content_src=

    for /f "delims=" %%x in (%verf_integrity_src_file%\checksum.md5) do (set content_src=!content_src! %%x)

    endlocal
    setlocal enabledelayedexpansion
    set content_dst=

    for /f "delims=" %%y in (%verf_integrity_dst_file%) do (set content_dst=!content_dst! %%y)

    endlocal

    @echo %content_dst%==%content_src%
这将不输出任何内容->==

其次,我尝试了一些类似的方法:

:verify_integrity
    set "verf_integrity_src_file=\\ROCIO-148084\c$\Users\z-perkins-thomas\Documents\bin\batch\verf"
    set "verf_integrity_dst_file=%cd%\docs\checksum.md5"
    pushd "%verf_integrity_src_file%"
    set verf_src=
    for /f "delims=" %%x in (%verf_integrity_src_file%\checksum.md5) do set verf_src=%verf_src% %%x
    set verf_dst=
    for /f "delims=" %%y in (%verf_integrity_dst_file%) do set verf_dst=%verf_dst% %%y
    @echo %verf_src%
    goto :verify_argv
这将输出校验和文件中的最后一行->22534f499bc7755d58412327853c8d9a*/zip存档/uslis0.1.zip


所以我的问题是,如何将这两个文件读入内存,并验证它们是否相互匹配?

要检查两个文件是否相同,请使用:

如果您确定这两个文件都存在,那么很容易:

fc "file1.ext" "file2.ext" >nul || echo ** UNVERIFIED ** 
如果不是,请明确检查%errorlevel%:


要仅检查两个文件是否相同,请使用:

如果您确定这两个文件都存在,那么很容易:

fc "file1.ext" "file2.ext" >nul || echo ** UNVERIFIED ** 
如果不是,请明确检查%errorlevel%:


哦,我甚至不知道那是件事哦,我甚至不知道那是件事