Jump to content

some batch file coding help needed...


Recommended Posts

Hey all,

There I was finally uploading my big fat present for all you intrepid Windows 98 se users (125mb in size) just today when I discovered a few more problems I hadn't noticed before. :huh: The solution involves being able to check the version of a dll file using the command line in Win98se --- i've been able to use other methods to see if a file needs replacing up till this point (some even quite ingenious if I say so myself!) but when you get a modified file that is exactly the same size as the one its replacing, and there were no registry keys created, then it seems the only way is to check the file version. But how can you do that from the command line? Does anyone know of a tool that interrogates a file for its version number?

Or is there another way to kill off my mangy & quite rabid dog of a problem?

I am just itching to upload my pressie :rolleyes: so fast help is much appreciated :yes: Thanks in advance!!!

EDIT: I've found a solution that checks 2 files to see if they are identical, not just in size but the contents as well. This should solve the problem, but i'd still be interested to know if the above can be done.

@echo off
:: this batch file compares 2 files to see if they are identical
@echo off
fc %1 %2> tmp$$$
type tmp$$$ | find /i "fc: no differences encountered" >nul
echo.
if ERRORLEVEL 1 echo Files %1 and %2 are different
if ERRORLEVEL 1 goto END
if ERRORLEVEL 0 echo Files %1 and %2 are identical
echo.
:END
PAUSE
CLS
EXIT

Edited by soporific
Link to comment
Share on other sites


The only way I know is to use filever.exe from a command prompt.

E:\FILEVER\FILEVER.EXE [/V] [/E] [/X] [/A] [/D] [[drive:][path][filena

me]]

/S Displays files in specified directory and all subdirectories.

/V List verbose version information if available.

/E List executables only.

/X Displays short names generated for non-8dot3 file names.

/B Uses bare format (no dir listing).

/A Don't display file attributes.

/D Don't display file date and time.

>c:\version.txt

before running your setup.bat

Works from command prompt but not in pure dos

----- W32i DLL ENU 4.0.0.1111 shp 819,200 08-24-1996 shell32.dll

Link to comment
Share on other sites

The only way I know is to use filever.exe from a command prompt.

E:\FILEVER\FILEVER.EXE [/V] [/E] [/X] [/A] [/D] [[drive:][path][filena

me]]

After some research I gather you are talking about the utility that is on the Windows 2000 or above CD. I then went looking for variations of filever.exe and found this

It spews out heaps of info, but more importantly it DOES display the crucial piece of information ... the problem I encountered was trying to determine if LLXX's Copy2Gb fix was installed or not. The info I can now search for is "FixedBy = LittyX" which I'm now glad she put in. Thankx LLXX.

So i have the solution, thanks for the tip dude.

:thumbup

Link to comment
Share on other sites

More help needed !!

I have decided to do more checking on my (now) multiple projects I want to release ASAP, and so I have created a test Win98 installation using a dummy drive and the D drive to install the operating system. This is to check that all updates properly recognise that Windows is a) not on the C drive, and b) not in a directory called Windows. The installation directory is D:\Win98

I have 2 questions:

1) How can you force Windows to install in a directory with a name that contains a space? I wanted to see if I put quotes around all the path locations in my code and this would have been a good way to check, but I can't seem to do it. I changed the msbatch.inf ChangeDir value from ChangeDir=0 to ChangeDir=1 so I could try lots of options, but Windows setup won't allow any variations with a space in the directory name. Or maybe I was doing something wrong. SO can anyone confirm if this is an official limitation? Or am i just a dunderhead...

2) I have also discovered something weird. So, I've performed a fresh, clean install of Win98se with absolutely no updates or fixes. And the weirdness is the OS seems to want to store its Autoexec.bat file on the C drive rather than on the D drive which is what I expected. I use the autoexec.bat file to perform some Real DOS file replacements that you can't use the wininit.ini method for (ie Copy2Gb) and it took a few minutes to realise why it wasn't working because the code was looking for an autoexec.bat file on the d drive when its on the C drive ... Anyone know why this is?

Thanks in advance ...

Link to comment
Share on other sites

1) How can you force Windows to install in a directory with a name that contains a space? I wanted to see if I put quotes around all the path locations in my code and this would have been a good way to check, but I can't seem to do it. I changed the msbatch.inf ChangeDir value from ChangeDir=0 to ChangeDir=1 so I could try lots of options, but Windows setup won't allow any variations with a space in the directory name. Or maybe I was doing something wrong. SO can anyone confirm if this is an official limitation? Or am i just a dunderhead...

2) I have also discovered something weird. So, I've performed a fresh, clean install of Win98se with absolutely no updates or fixes. And the weirdness is the OS seems to want to store its Autoexec.bat file on the C drive rather than on the D drive which is what I expected. I use the autoexec.bat file to perform some Real DOS file replacements that you can't use the wininit.ini method for (ie Copy2Gb) and it took a few minutes to realise why it wasn't working because the code was looking for an autoexec.bat file on the d drive when its on the C drive ... Anyone know why this is?

Thanks in advance ...

1. That's a bad idea. Windows directory needs to be accessible from DOS, and so should conform to 8.3 naming convention.

2. Is the BIOS booting the C drive or the D drive, i.e. where is the kernel (MSDOS.SYS and IO.SYS) stored? The autoexec.bat and config.sys are located on the same drive that the DOS kernel is.

Link to comment
Share on other sites

1. That's a bad idea. Windows directory needs to be accessible from DOS, and so should conform to 8.3 naming convention.

2. Is the BIOS booting the C drive or the D drive, i.e. where is the kernel (MSDOS.SYS and IO.SYS) stored? The autoexec.bat and config.sys are located on the same drive that the DOS kernel is.

Consciously installing Windows 98se into a directory with spaces IS a bad idea, I agree, but if you re-read the context, it was only to check that my code for my Win98se "yeah yeah so where the hell are they" projects are fool-proof. Are you saying that this is an OFFICIAL limitation by Microsloth and they prohibit you from doing it? Which is my original question ... :)

With regard to the autoexec.bat, the drives layout is:

- C: drive is a Primary partition, formatted with FAT32

- D: is a logical partition, formatted with FAT32

IO.sys and MSDOS.sys are both on the C drive. I guess its got something to do with no support for multiple visible primary partitions (as Partition Magic tells me). So the OS uses the 1st primary partition for some system files. If this is always the case, then the code is fine ... autoexec.bat will always be in the C:\autoexec.bat location. Or am i missing something here ...

Edited by soporific
Link to comment
Share on other sites

FDISK won't let you do it, but you can create more than one primary partition and boot from any of them.

Yes you can, but for my context (that word keeps popping up!) if you created two primary partitions, one of them will be hidden and thus the drive letters won't be right. I wanted to test an installation on the d drive, but if you have 2 primary partitons, Windows will only see one of them and won't allow a d drive install (unless that is you also have a logical partition after the primaries).

So, really, what I am asking is --- is it humanly possible to have a windows 98 installation with the autoexec.bat on any other drive than the C drive? To achieve this, Windows will have to *SEE* both primary partitions in order to avoid using the first one. And Parition Magic 8 tells me that data corruption may occur if Windows sees 2 primaries.

Again, the only reason I'm asking is to know for sure that my code won't break. I am NOT looking to perform weird installations of Windows 98se for the fun of it. It is so I don't have a red face when my code breaks. In fact, the Copy2gb_installer I just posted a few minutes ago will break if this is the case. LLXX, I would suggest you have an interest in it working perfectly B) Let me know if the installer is of any use!

Link to comment
Share on other sites

So, really, what I am asking is --- is it humanly possible to have a windows 98 installation with the autoexec.bat on any other drive than the C drive?

Short answer: NO

Long Answer: NO, but this has nothing to do with Windows 9x, is a "feature" of DOS:

On the SAME drive that was booted MUST reside:

IO.SYS

MSDOS.SYS

Autoexec.bat

Config.sys

and, normally, COMMAND.COM (but this can be changed through a setting in Autoexec.bat):

http://goforit.unk.edu/msdos/msdos09.htm

The same reason why you cannot rename "Autoexec.bat" to, say, "myauto.bat", those filenaes are encoded in the DOS files, and they must be on THAT same partition.

Nothing prevents you however to make a c:\autoexec.bat like this:

CALL D:\Autoexec.bat

Moreover, though I cannot say if it useful in your "context" ;) Windows 98 can be installed "completely" to a Logical Volume inside extended partition:

http://www.allensmith.net/OS/XOSL/II.htm#II1

of course you will need a boot manager to hide partitions preceding the one on which you installed Windows 98, or those ones need to be with a filesystem that Win98 won't recognize, but the drive booted will remain "C:".

Another interesting approach could be the one hinted here, though I never tested it for this particular purpose:

http://www.geocities.com/freedatarecovery/

http://www.v72735.f2s.com/LetAssig/index.html

but again, since the Letter Assigner has to be invoked from Autoexec.bat, you will however need to have it on the initial boot "C:" drive.

jaclaz

P.S.: to check version of a .dll/.exe/.ocx, check this also:

http://lbrisar.htmlplanet.com/e_cmd32.html#top

Edited by jaclaz
Link to comment
Share on other sites

1) How can you force Windows to install in a directory with a name that contains a space? I wanted to see if I put quotes around all the path locations in my code and this would have been a good way to check, but I can't seem to do it. I changed the msbatch.inf ChangeDir value from ChangeDir=0 to ChangeDir=1 so I could try lots of options, but Windows setup won't allow any variations with a space in the directory name. Or maybe I was doing something wrong. SO can anyone confirm if this is an official limitation? Or am i just a dunderhead...

I don't think you can. The first phase of the windows setup wizard (where you choose the windows directory and all the files are copied) is a windows 3.1 program, which means it cannot understand or use long file names. So windows will always be installed to a short name directory.

Link to comment
Share on other sites

You may wish to run Letter Assigner [the native DOS executable] from your config.sys [which has to be on C:\ root] with a command like this:

INSTALL=C:\LETASSIG\LETASSIG.EXE

Most executables/TSRs/devices/memory residents that are meant to run either from autoexec.bat or from native DOS prompt can be run from within config.sys using the INSTALL / INSTALLHIGH commands.

All MS-DOS 6/7/8 editions have install(high) built-in.

INSTALLHIGH is only used if upper memory is present at boot time by loading an UMA/UMB memory manager [uMBPCI.SYS, EMM386.EXE, QEMM386.SYS, RM386.EXE, 386MAX.SYS etc], and if you want to load "high" [in UMA] a device/driver/TSR/memory resident program.

MSCDEX, SMARTDRV, MOUSE*.*, DOSKEY etc can be loaded this way from config.sys, for example.

Then you can load up your autoexec.bat from the drive/partition created/reassigned by LetAssig.

This is only a suggestion, I have never used Letter Assigner.

Another solution that doesn't involve LetAssig [but is only a workaround] would be to create a "fake" autoexec.bat in C:\ root, with these 2 lines:

@echo off

call d:\bats\autoexec.bat

which in turn will run your "real" autoexec.bat from D:\BATS , or wherever else you want to place it into.

Your d:\bats\autoexec.bat can also be named to anything else, if you like, but don't change its file extension.

______________________________

glaurung:

Good point.

M$ Windows [any edition/version, including all 3.xx, 9x + NTx based OSes] cannot install in a LFN directory.

Windows install folder must abide by MS-DOS SFNs [short File Names] convention: 8.3 characters, which cannot be certain symbols, like:

/ \ ? > < | * " :

______________________________

IMO:

Autoexec.bat and config.sys names and extensions [but not their locations] can be changed by hexing IO.SYS [which has to reside inside C:\ root] using any decent hex editor.

And I believe COMMAND.COM name [extension must be COM or EXE] can be changed this way too.

HTH

Edited by MDGx
Link to comment
Share on other sites

1) How can you force Windows to install in a directory with a name that contains a space? I wanted to see if I put quotes around all the path locations in my code and this would have been a good way to check, but I can't seem to do it. I changed the msbatch.inf ChangeDir value from ChangeDir=0 to ChangeDir=1 so I could try lots of options, but Windows setup won't allow any variations with a space in the directory name. Or maybe I was doing something wrong. SO can anyone confirm if this is an official limitation? Or am i just a dunderhead...

As it was already explained it seems to be not possible to force Windows setup to use LFN.

Just one idea that might work - untested:

1. Create "C:\Long Windows Directory" directory before starting setup. SFN will be "LONGWI~1"

2. Ask Windows Setup to use "LONGWI~1" directory

Will it work?

Petr

Link to comment
Share on other sites

As it was already explained it seems to be not possible to force Windows setup to use LFN.

Just one idea that might work - untested:

1. Create "C:\Long Windows Directory" directory before starting setup. SFN will be "LONGWI~1"

2. Ask Windows Setup to use "LONGWI~1" directory

Will it work?

Petr

This works, because it downgrades the LFN to a supported SFN [tilde + 1, tilde + 2 etc...].

But the orignal LFN will be lost.

So it's back to square 1. ;-(

M$ Windows all editions/builds cannot use LFN for install folder name.

This is because the OS loader has to recognize and use the install folder before the LFN component has a chance to load.

This is valid even for NTx OSes, because they too load on top of a stripped-down boot loader, without LFN support.

LFN support component must load later in the sequence.

Edited by MDGx
Link to comment
Share on other sites

2) I have also discovered something weird. So, I've performed a fresh, clean install of Win98se with absolutely no updates or fixes. And the weirdness is the OS seems to want to store its Autoexec.bat file on the C drive rather than on the D drive which is what I expected. I use the autoexec.bat file to perform some Real DOS file replacements that you can't use the wininit.ini method for (ie Copy2Gb) and it took a few minutes to realise why it wasn't working because the code was looking for an autoexec.bat file on the d drive when its on the C drive ... Anyone know why this is?

In such circumstances I use subst.exe for drive substitution c: ==)e:, takes care of a lot of os boot/file dependency problems. lfn after install I adapt the folders with no spaces, program folders, start menu etc to bypass any lfn restrictions and win9x adjusts.

Keep up the good work, all the best

Link to comment
Share on other sites

wow, heaps of feedback and help! you guys rock ...

Another question:

In Windows 98, how can you determine if the OS has been installed on a laptop computer? It should be easy I would imagine, I just don't know ... are there files that get used only on a laptop? or can we determine this some other way?

The reason is I want the autopatcher to only install laptop updates on computers that are laptops. People with desktops i imagine will feel that installing those updates is pointless and a waste of space, so if its easy to determine this, I will add this check.

Thanks in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...