Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.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 - Fatal编程技术网

Batch file 我需要比较两个文本文件,并希望将结果存储在一个新文件中

Batch file 我需要比较两个文本文件,并希望将结果存储在一个新文件中,batch-file,Batch File,我需要比较两个文本文件,并希望将结果存储在一个新文件中。此代码没有帮助 findstr /vixg:oldstatus.txt newstatus.txt > diff.txt 它只是给出newstatus.txt的输出。它没有显示出区别。可能是这样的吗 @echo off for /f %%a in (oldstatus.txt) do ( findstr /i /v /c:"%%a" newstatus.txt >>diff.txt ) pause 有关findstr

我需要比较两个文本文件,并希望将结果存储在一个新文件中。此代码没有帮助

findstr /vixg:oldstatus.txt newstatus.txt > diff.txt 
它只是给出newstatus.txt的输出。它没有显示出区别。

可能是这样的吗

@echo off
for /f %%a in (oldstatus.txt) do (
findstr /i /v /c:"%%a" newstatus.txt >>diff.txt
)
pause
有关
findstr
命令的帮助:
另请参见:

和:

您可以使用
fc
命令显示两个文件之间的差异。
/c
选项执行不区分大小写的比较,如
findstr
/i
选项

fc oldstatus.txt newstatus.txt >diff.txt
fc/?
的输出:

Compares two files or sets of files and displays the differences between them


FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]
   [drive1:][path1]filename1 [drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2

/A         Displays only first and last lines for each set of differences.
/B         Performs a binary comparison.
/C         Disregards the case of letters.
/L         Compares files as ASCII text.
/LBn       Sets the maximum consecutive mismatches to the specified
           number of lines.
/N         Displays the line numbers on an ASCII comparison.
/OFF[LINE] Do not skip files with offline attribute set.
/T         Does not expand tabs to spaces.
/U         Compare files as UNICODE text files.
/W         Compresses white space (tabs and spaces) for comparison.
/nnnn      Specifies the number of consecutive lines that must match
           after a mismatch.
[drive1:][path1]filename1
           Specifies the first file or set of files to compare.
[drive2:][path2]filename2
           Specifies the second file or set of files to compare.

您希望在结果文件中看到什么?PowerShell是一个选项吗?