Solved

Batch file programming - updating files.

Posted on 1998-11-09
7
160 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 2012 STD Updates Issue 15 52
SBS Server 2011 does not recognize a PC as being Online 8 49
Thoughts on PC Doctor 11 48
Windows 10 disk usage 100%. 28 73
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
An article on effective troubleshooting
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

777 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