Jump to content

Windows 9x system copy switcher.


Sfor

Recommended Posts

When comes to testing some software or system patches it is a very good idea to make a copy of the Windows and Program Files directories. There are many easy ways to do it. But, the things are getting a bit more complicated when it comes to restoring the system. The simplest way for me was to doot to DOS and run the DOSLFNMS.COM and then to switch the directories with RENAME command. After a few times I felt tired with constantly typing: RENAME P1 "Program Files". So I've decided to make a script.

The script grew with time. The idea is to keep up to 9 backup system copies with W1,W2,..,W9 (Windows) and P1,P2,...,P9 ("Program FIles") folders. The switching script displays the list of available copies, then exchanges the current system with the selected backup copy slot. The slots are simply named W1,W2,...,W9, but it is possible to provide additional description through placement of a INFO.TXT file in Wx folder.

The script and the DOSLFNMS.COM driver should be placed in the C:\ folder. It is possible to call it directly, or from AUTOEXEC.BAT or CONFIG.SYS files.

Echo OFF
doslfnms.com
cls
Echo Current OS:
if not exist c:\windows\info.txt ECHO No decription.
Type c:\WINDOWS\info.txt
Echo.
Echo.
if exist c:\w1\win.com Echo 1 - W1
if exist c:\w1\info.txt type c:\w1\info.txt
if exist c:\w1\win.com Echo.
if exist c:\w2\win.com Echo 2 - W2
if exist c:\w2\info.txt type c:\w2\info.txt
if exist c:\w2\win.com Echo.
if exist c:\w3\win.com Echo 3 - W3
if exist c:\w3\info.txt type c:\w3\info.txt
if exist c:\w3\win.com Echo.
if exist c:\w4\win.com Echo 4 - W4
if exist c:\w4\info.txt type c:\w4\info.txt
if exist c:\w4\win.com Echo.
if exist c:\w5\win.com Echo 5 - W5
if exist c:\w5\info.txt type c:\w5\info.txt
if exist c:\w5\win.com Echo.
if exist c:\w6\win.com Echo 6 - W6
if exist c:\w6\info.txt type c:\w6\info.txt
if exist c:\w6\win.com Echo.
if exist c:\w7\win.com Echo 7 - W7
if exist c:\w7\info.txt type c:\w7\info.txt
if exist c:\w7\win.com Echo.
if exist c:\w8\win.com Echo 8 - W8
if exist c:\w8\info.txt type c:\w8\info.txt
if exist c:\w8\win.com Echo.
if exist c:\w9\win.com Echo 9 - W9
if exist c:\w9\info.txt type c:\w9\info.txt
if exist c:\w9\win.com Echo.
Echo 0 - Exit
Echo.
Choice /C:1234567890 Select slot
if Errorlevel 1 Set SYS=1
if Errorlevel 2 Set SYS=2
if Errorlevel 3 Set SYS=3
if Errorlevel 4 Set SYS=4
if Errorlevel 5 Set SYS=5
if Errorlevel 6 Set SYS=6
if Errorlevel 7 Set SYS=7
if Errorlevel 8 Set SYS=8
if Errorlevel 9 Set SYS=9
if Errorlevel 10 Goto END

rename WINDOWS WX
rename "Program Files" PX
rename W%SYS% WINDOWS
rename P%SYS% "Program Files"
rename WX W%SYS%
rename PX P%SYS%
:END

The DOSLFNMS.COM is a part of the DOSLFN package. It's function is to provide the long file name support in the "Clean DOS".

Edited by Sfor
Link to comment
Share on other sites


The DOSLFN driver needed by the system switcher can be found here http://www.geocities.com/jadoxa/doslfn/ and here: http://www.ibiblio.org/pub/micro/pc-stuff/.../system/doslfn/

The switching script seams to be working correctly. On the other hand it would be good to be able to make system copies in an automated way, as well.

As for me I do prefer to do it manualy. As, the system folders retain the proper attributes, that way. Still the proper folder attributes are not required for the system to be working correctly. So, it is possible to make a system copy using XCOPY command.

Here is what I have came up with:

ECHO OFF
if not exist C:\W9\nul SET SYS=9
if not exist C:\W8\nul SET SYS=8
if not exist C:\W7\nul SET SYS=7
if not exist C:\W6\nul SET SYS=6
if not exist C:\W5\nul SET SYS=5
if not exist C:\W4\nul SET SYS=4
if not exist C:\W3\nul SET SYS=3
if not exist C:\W2\nul SET SYS=2
if not exist C:\W1\nul SET SYS=1
Echo %SYS%
xcopy /E /H /I /C C:\WINDOWS C:\W%SYS%
xcopy /E /H /I /C "C:\Program Files" C:\P%SYS%

What it does is a copy of the Windows and Program Files folders in the first free system switcher slot. It should be run under Windows. The file copy operations under DOS are slower, and the DOSLFN driver would be necesary to be loaded, in such a case. So, it is simpler to do the copying, when the Windows is working.

Edited by Sfor
Link to comment
Share on other sites

What it does is a copy of the Windows and Program Files folders in the first free system switcher slot. It should be run under Windows. The file copy operations under DOS are slower, and the DOSLFN driver would be necesary to be loaded, in such a case. So, it is simpler to do the copying, when the Windows is working.

If you absolutely need anything like that to be done on DOS, I suggest using UIDE to enable UDMA transfers in bare DOS, and also do some nice caching. I myself always load UIDE (after altering IOS.INI or .SYS... don't remember exactly, to tell Windows the driver is safe so Windows will handle the HD itself, instead of using DOS)

Link to comment
Share on other sites

Doing the copy in Windows has more advantages than the speed. The LFNDOS can have some problems handling country specific code pages. It can cause some file names to be handled in a wrong way. In case of an English language system, there should not be a problem.

On the other hand, the XCOPY itself can have problems with some ANSI characters. So, the only perfect copy can be done with the Windows Explorer (for an instance).

The script I've provided will not work correctly in DOS in any case. The reason is the XCOPY command run in DOS and in Windows behaves differently. The amount of switches available in DOS is very limited. This is caused by the fact there are two XCOPY code versions. The 16bit code works just in DOS. In case if the Windows GUI is present the 32bit code wersion is called instead of the 16 bit one. The 32 bit code is much more sophisticated and supports more options.

Edited by Sfor
Link to comment
Share on other sites

Doing the copy in Windows has more advantages than the speed. The LFNDOS can have some problems handling country specific code pages. It can cause some file names to be handled in a wrong way. In case of an English language system, there should not be a problem.

Actually, DOSLFN (not LFNDOS, LFNDOS is sloooooooow and buggy) can handle international characters perfectly, as long as it is configured right.

On the other hand, the XCOPY itself can have problems with some ANSI characters. So, the only perfect copy can be done with the Windows Explorer (for an instance).

The script I've provided will not work correctly in DOS in any case. The reason is the XCOPY command run in DOS and in Windows behaves differently. The amount of switches available in DOS is very limited. This is caused by the fact there are two XCOPY code versions. The 16bit code works just in DOS. In case if the Windows GUI is present the 32bit code wersion is called instead of the 16 bit one. The 32 bit code is much more sophisticated and supports more options.

Perhaps using a free alternative to XCOPY would be better... just in case someone ever needs to do this in DOS, and to avoid trouble with these ANSI characters...

Link to comment
Share on other sites

The DOSLFN can handle the ANSI character only as good as the Windows does. Unfortunately it is not possible to translate all the ANSI characters to the corresponding characters in a DOS codepage. So, it is not possible for a DOS application to copy file names with some ANSI characters included. Only a 32 bit GUI application can do the job correctly, because there is no character translation on the way, in such a case.

The conclusion is any application working with the DOS LFN interface will not be able to copy certain ANSI characters. Because, the Windows DOS LFN services extension is the cause.

I have to admit I was using DOSLFN and LFNDOS as the same name. In any case I had the DOSLFN on my mind.

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...