Sfor Posted July 30, 2008 Share Posted July 30, 2008 (edited) 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 OFFdoslfnms.comclsEcho Current OS:if not exist c:\windows\info.txt ECHO No decription.Type c:\WINDOWS\info.txtEcho.Echo.if exist c:\w1\win.com Echo 1 - W1if exist c:\w1\info.txt type c:\w1\info.txtif exist c:\w1\win.com Echo.if exist c:\w2\win.com Echo 2 - W2if exist c:\w2\info.txt type c:\w2\info.txtif exist c:\w2\win.com Echo.if exist c:\w3\win.com Echo 3 - W3if exist c:\w3\info.txt type c:\w3\info.txtif exist c:\w3\win.com Echo.if exist c:\w4\win.com Echo 4 - W4if exist c:\w4\info.txt type c:\w4\info.txtif exist c:\w4\win.com Echo.if exist c:\w5\win.com Echo 5 - W5if exist c:\w5\info.txt type c:\w5\info.txtif exist c:\w5\win.com Echo.if exist c:\w6\win.com Echo 6 - W6if exist c:\w6\info.txt type c:\w6\info.txtif exist c:\w6\win.com Echo.if exist c:\w7\win.com Echo 7 - W7if exist c:\w7\info.txt type c:\w7\info.txtif exist c:\w7\win.com Echo.if exist c:\w8\win.com Echo 8 - W8if exist c:\w8\info.txt type c:\w8\info.txtif exist c:\w8\win.com Echo.if exist c:\w9\win.com Echo 9 - W9if exist c:\w9\info.txt type c:\w9\info.txtif exist c:\w9\win.com Echo.Echo 0 - ExitEcho.Choice /C:1234567890 Select slotif Errorlevel 1 Set SYS=1if Errorlevel 2 Set SYS=2if Errorlevel 3 Set SYS=3if Errorlevel 4 Set SYS=4if Errorlevel 5 Set SYS=5if Errorlevel 6 Set SYS=6if Errorlevel 7 Set SYS=7if Errorlevel 8 Set SYS=8if Errorlevel 9 Set SYS=9if Errorlevel 10 Goto ENDrename WINDOWS WXrename "Program Files" PXrename W%SYS% WINDOWSrename P%SYS% "Program Files"rename WX W%SYS%rename PX P%SYS%:ENDThe 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 July 30, 2008 by Sfor Link to comment Share on other sites More sharing options...
Sfor Posted August 6, 2008 Author Share Posted August 6, 2008 (edited) 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 OFFif not exist C:\W9\nul SET SYS=9if not exist C:\W8\nul SET SYS=8if not exist C:\W7\nul SET SYS=7if not exist C:\W6\nul SET SYS=6if not exist C:\W5\nul SET SYS=5if not exist C:\W4\nul SET SYS=4if not exist C:\W3\nul SET SYS=3if not exist C:\W2\nul SET SYS=2if not exist C:\W1\nul SET SYS=1Echo %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 August 6, 2008 by Sfor Link to comment Share on other sites More sharing options...
alexanrs Posted August 6, 2008 Share Posted August 6, 2008 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 More sharing options...
Sfor Posted August 6, 2008 Author Share Posted August 6, 2008 (edited) 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 August 6, 2008 by Sfor Link to comment Share on other sites More sharing options...
alexanrs Posted August 6, 2008 Share Posted August 6, 2008 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 More sharing options...
Sfor Posted August 7, 2008 Author Share Posted August 7, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now