.bat脚本比较两个Windows文件夹的内容 [英] .bat script to compare contents of two windows folders

查看:964
本文介绍了.bat脚本比较两个Windows文件夹的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个简短的.bat脚本来比较两个文件夹的内容。

I would like to write a short .bat script to compare the contents of two folders.

文件夹1:包含1300个文件。
文件夹2:包含大约400个文件。

Folder 1: Contains some 1300 files. Folder 2: Contains some 400 files.

我想要一个脚本,我可以在Windows命令行中运行该脚本,以对Folder 2中的每个文件进行检查查看文件夹1中是否有相同名称的文件...,如果是,则将文件夹2文件的名称输出为.csv文件(或记事本,我很简单,只需要一个列表!)。

I would like to have a script I can run through the windows command line that takes each file in Folder 2 checks to see if a file with the same name is in Folder 1... and if it is Outputs the name of the Folder 2 file to a .csv file (or notepad I'm easy just want a list!).

任何想法或帮助将不胜感激!

Any thoughts or help would be much appreciated!

推荐答案

尝试一下

(for %%i in ("folder2\*") do if exist "folder1\%%~nxi" echo(%%~i)>file.csv

这篇关于.bat脚本比较两个Windows文件夹的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆