How to Use FC (File Compare) from the Windows Command Prompt

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

How to Use FC (File Compare) from the Windows Command Prompt

#1 Post by Ed Dyreen » 31 Aug 2018 03:19

So I have 2 windows server 2003 enterprise images.

-One is windows server 2003 enterprise R2 SP1 VLK.
This is a problem, many of my old programs cannot to be installed correctly if installed after SP1 is installed.
I don't need R2 but could not find a way to disable R2 inside unattended.sif

-The other is windows server 2003 enterprise retail.
This is good but not a VLK i don't want having to activate windows after installation or integrating service packs.

So I used the FC command ( probably incorrectly ) to compare these two folders.

Code: Select all

FC "folder1\*" "folder2\*"
I just want it to tell me which files exist in folder1 that are missing in folder2.
I want to make this comparison because i want to see if i can turn a SP1 or SP2 distro into an SP0 by deleting and or moving files from one image to another.

I've been thinking about changing the retail distro into a VLK edition but i think my chance of success is slim. This is probably coded inside setup.exe which will probably detect tampering with source files if done incorrectly.

The command has been running for days now i fear it's comparing the contents of all files rather than just telling which files exist in folder1 that are missing in folder2.

Can I get FC to do what I want or will I have to compare them in a different way ?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: How to Use FC (File Compare) from the Windows Command Prompt

#2 Post by Ed Dyreen » 31 Aug 2018 04:41

I downloaded winMerge, it just compared both folder trees in only a few minutes.

It tells me which files exist in one folder but not in the other, which files are identical and which are not.

sst
Posts: 93
Joined: 12 Apr 2018 23:45

Re: How to Use FC (File Compare) from the Windows Command Prompt

#3 Post by sst » 31 Aug 2018 04:47

Ed Dyreen wrote:
31 Aug 2018 03:19
i fear it's comparing the contents of all files rather than just telling which files exist in folder1 that are missing in folder2.
Yes, FC just compares the file contents nothing more.
You mean something like this? Honestly I get confused as I'm sure you know this.

Code: Select all

for %A in (folder1\*) do @if not exist "folder2\%~nxA" echo %~nxA

Ed Dyreen wrote:
31 Aug 2018 03:19
I just want it to tell me which files exist in folder1 that are missing in folder2.
I want to make this comparison because i want to see if i can turn a SP1 or SP2 distro into an SP0 by deleting and or moving files from one image to another.
It's not as simple as that, Actually it's impossible to convert a higher SP to a lower one. It is not about some additional files that can be removed to get the lower SP, but almost all files are different and they are digitally signed by catalog files. It is almost like of you want to convert Windows 7 to Windows XP. If you have the license the only option you have is find a SP0 original image.

BTW did you try the compatibility option to install your apps on SP1 or SP2 ?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: How to Use FC (File Compare) from the Windows Command Prompt

#4 Post by Ed Dyreen » 31 Aug 2018 07:51

sst wrote:
31 Aug 2018 04:47
Ed Dyreen wrote:
31 Aug 2018 03:19
i fear it's comparing the contents of all files rather than just telling which files exist in folder1 that are missing in folder2.
Yes, FC just compares the file contents nothing more.
You mean something like this? Honestly I get confused as I'm sure you know this.

Code: Select all

for %A in (folder1\*) do @if not exist "folder2\%~nxA" echo %~nxA
I was looking for a program that could do it faster and "better". I am satisfied with winMerge.
sst wrote:
31 Aug 2018 04:47
Ed Dyreen wrote:
31 Aug 2018 03:19
I just want it to tell me which files exist in folder1 that are missing in folder2.
I want to make this comparison because i want to see if i can turn a SP1 or SP2 distro into an SP0 by deleting and or moving files from one image to another.
It's not as simple as that, Actually it's impossible to convert a higher SP to a lower one. It is not about some additional files that can be removed to get the lower SP, but almost all files are different and they are digitally signed by catalog files. It is almost like of you want to convert Windows 7 to Windows XP. If you have the license the only option you have is find a SP0 original image.

BTW did you try the compatibility option to install your apps on SP1 or SP2 ?
I have all SP0 files, they reside on a retail distro. Then the problem is figuring out exactly where windows decides what type of distro it is and replacing those files from another image. but then if this is a different service pack it will not work.

"find a SP0 original image". that is the problem, windows server 2003 enterprise VLK SP0 seems hard to find these days. either they are retail or they are vlk but slipstreamed.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: How to Use FC (File Compare) from the Windows Command Prompt

#5 Post by Ed Dyreen » 23 Sep 2018 15:05

I now have Windows Server 2003 Enterprise MSDN RTM Corporate Edition x86 SP0 en.
and Windows Server 2003 Enterprise Edition VLK x86 SP0 en.

I want to share some interesting facts that I figured out wayback but forgot about.
The document talks about XP but this also applies to windows server 2003 series.
Windows OEM, RTM or VLK wrote: Note: This step can be used to check or verify the channel version of a Windows XP CD or image too. And it does not convert CD or image to royalty OEM Windows XP, which requires some OEM files to be existed.

Copy all content of Windows XP CD to hard disk drive, or extract Windows XP disc image to a folder.
Open the file \i386\setupp.ini in any text editor such as Notepad.
Inside the setupp.ini, there is a “Pid” parameter with [Pid] header. The Pid variable consists of 2 parts. The first 5 digits is Microsoft product code (MPC) which determines the version of Windows XP that will be installed, the last 3 digits is channel ID that determines which CD-keys or product keys that the installation wizard will accept. Some example of standard combination for Pid for various editions of Windows XP:
Windows XP RTM
Retail: 51882335 (Retail edition accepting Retail CD keys)
Volume License: 51883270 (Volume License edition accepting Volume License keys or VLK)
OEM: 82503OEM (OEM edition accepting OEM keys or COA keys)

Windows XP SP2

Retail: 55274335
Volume License: 55274270
OEM: 55277OEM

Windows XP SP3

Retail: 76487335
Volume License: 76487270
OEM: 76487OEM

The first 5 digits of Pid is normally stayed the same for same version of Windows XP (i.e. RTM, SP1, SP2 or SP3). Thus, only the last 3 digits of Pid needs to be modified according to example above. Generally, channel ID for retail is 335, OEM is OEM, and volume licensing is 270.
Use nLite or other disc imaging program to re-create or re-burn the modified Windows XP installation disc media or image.
Note: Newer Windows XP discs may check whether the CD’s volume label matches the type of CD too. In this case, the wrong volume label may still render the disc unworkable. Here’s a brief list of known English version of Windows XP CD volume labels.

XP Home and Professional Combo = WXPHFPP_EN

XP Home Retail = WXHFPP_EN
XP Home Retail with SP1 = XRMHFPP_EN
XP Home Retail with SP1a = X1AHFPP_EN
XP Home Retail with SP2 = VRMHFPP_EN
XP Home Upgrade = WXHCCP_EN
XP Home Upgrade with SP1 = XRMHCCP_EN
XP Home Upgrade with SP1a = X1AHCCP_EN
XP Home Upgrade with SP2 = VRMHCCP_EN
XP Home OEM = WXHOEM_EN
XP Home OEM with SP1 = XRMHOEM_EN
XP Home OEM with SP1a = X1AHOEM_EN
XP Home OEM with SP2 = VRMHOEM_EN
XP Home Volume = WXHVOL_EN
XP Home Volume with SP1 = XRMHVOL_EN
XP Home Volume with SP1a = X1AHVOL_EN
XP Home Volume with SP2 = VRMHVOL_EN

XP Professional Retail = WXPFPP_EN
XP Professional Retail with SP1 = XRMPFPP_EN
XP Professional Retail with SP1a = X1APFPP_EN
XP Professional Retail with SP2 = VRMPFPP_EN
XP Professional Upgrade = WXPCCP_EN
XP Professional Upgrade with SP1 = XRMPCCP_EN
XP Professional Upgrade with SP1a = X1APCCP_EN
XP Professional Upgrade with SP2 = VRMPCCP_EN
XP Professional OEM = WXPOEM_EN
XP Professional OEM with SP1 = XRMPOEM_EN
XP Professional OEM with SP1a = X1APOEM_EN
XP Professional OEM with SP2 = VRMPOEM_EN
XP Professional Volume = WXPVOL_EN
XP Professional Volume with SP1 = XRMPVOL_EN
XP Professional Volume with SP1a = X1APVOL_EN
XP Professional Volume with SP2 = VRMPVOL_EN
XP Professional Tablet PC with SP1 Disc1 = XRMPFPP_EN
XP Professional Tablet PC with SP1a Disc1 = X1APFPP_EN
XP Professional Tablet PC with SP2 Disc1 = VRMPFPP_EN
XP Professional MSDN = WXPFPP_EN
XP Professional MSDN with SP1 = XRMPFPP_EN
XP Professional MSDN with SP1a = X1APFPP_EN
XP Professional MSDN with SP2 = VRMPFPP_EN
XP Professional Evaluation = WXPEVL_EN

Post Reply