Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

Batch file programming - updating files.

I'm trying to produce a bootable disk which will detect the version of windows, either 3.11 or 3.1 and overwrite the winfile.exe with the MS year 2000 compliant one.  However how can I tell the version from within a batch file?  What commands can I use to determine which copy to copy across.  It needs to be done automatically because it needs sending around the country to my companies branches.  The users cannot be trusted to do it on their own.
0
mmanning
Asked:
mmanning
  • 3
  • 2
  • 2
1 Solution
 
rwilson032697Commented:
Include on the disk a small 16 or 32 bit checksum program. Have the batch file or program on the bootable disk run the checksum program over the winfile.exe program and check the result against the known checksums for the 3.1 and 3.11 versions. Based on that copy the correct one over...

Cheers,

Raymond.
0
 
mmanningAuthor Commented:
R.Wilson could you please give me some more informatin on how to do this.
0
 
mmanningAuthor Commented:
Additional information needed on how to do it!  Thanks
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
cbo120897Commented:
First you must compare the existing file with the right one at your bootdisk:

use ctree170.zip from http://oak.oakland.edu/simtel.net/msdos/fileutil.html

The errorlevel will show you, if you must update the file or not.

Example:
At bootdisk you have the correct winfile.exe, then you must run the following batch:
-----------------------------------------------------------------
@echo off
A:\ct.exe A:\winfile.exe C:\WINDOWS\winfile.exe
if errorlevel 9 goto diff
if errorlevel 8 goto diff
if errorlevel 7 goto diff
if errorlevel 6 goto diff
if errorlevel 5 goto diff
if errorlevel 4 goto diff
if errorlevel 3 goto diff
if errorlevel 2 goto diff
if errorlevel 1 goto diff
if errorlevel 0 goto nodiff
:diff
echo on HDD is the old version ...
copy A:\winfile.exe C:\WINDOWS\winfile.exe
goto end
:nodiff
echo on HDD is the right version ...
goto end
:end
-----------------------------------------------------------------

see at ct.exe /ERR? to use the return level for other things (for instance target file not founfd ...)

bye cbo
0
 
rwilson032697Commented:
cho is on the right track, but his method won't distinguish between versions (I think).

Cheers,

Raymond.
0
 
cbo120897Commented:
Hi rwilson,
I think different versions have different byte structure (and file size).
0
 
mmanningAuthor Commented:
Raymond I produced a bootable disk which works carries out the task well.  

Thankyou
MManning
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now