Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Batch file programming - updating files.

Posted on 1998-11-09
7
Medium Priority
?
168 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
cbo120897 earned 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

916 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