Solved

Batch file programming - updating files.

Posted on 1998-11-09
7
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Determining the an SCCM package name from the Package ID
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

710 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