Solved

Batch file programming - updating files.

Posted on 1998-11-09
7
158 Views
Last Modified: 2013-12-29
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
Comment
Question by:mmanning
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1804898
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
 
LVL 1

Author Comment

by:mmanning
ID: 1804899
R.Wilson could you please give me some more informatin on how to do this.
0
 
LVL 1

Author Comment

by:mmanning
ID: 1804900
Additional information needed on how to do it!  Thanks
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 3

Accepted Solution

by:
cbo120897 earned 100 total points
ID: 1804901
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
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1804902
cho is on the right track, but his method won't distinguish between versions (I think).

Cheers,

Raymond.
0
 
LVL 3

Expert Comment

by:cbo120897
ID: 1804903
Hi rwilson,
I think different versions have different byte structure (and file size).
0
 
LVL 1

Author Comment

by:mmanning
ID: 1804904
Raymond I produced a bootable disk which works carries out the task well.  

Thankyou
MManning
0

Featured Post

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

Suggested Solutions

Several part series to implement Internet Explorer 11 Enterprise Mode
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now