China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 12:16
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Urgent][Help] Brothers passing by, please give this little brother some guidance! View 3,889 Replies 27
Floor 16 Posted 2004-01-16 00:00 ·  中国 浙江 杭州 临安区 电信
银牌会员
★★
三生缘里笑红尘
Credits 1,063
Posts 292
Joined 2003-03-09 00:00
23-year member
UID 1073
Gender Male
Status Offline
Bump
Floor 17 Posted 2004-01-25 00:00 ·  中国 安徽 芜湖 电信
银牌会员
★★
三生缘里笑红尘
Credits 1,063
Posts 292
Joined 2003-03-09 00:00
23-year member
UID 1073
Gender Male
Status Offline
Floor 18 Posted 2004-01-26 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re pizigao:

This is the preliminary code, you can test it:

@echo off
if == goto %2

call %0 $ locate c d e f g h i j k
if == goto error1
goto collect

:locate
if == goto end
if exist %3:\Rightium\Nul set base=%3:
if exist %3:\Progra~1\Rightium\Nul set base=%3:\Progra~1
if not == goto end
shift
goto locate

:collect
dir %base%\Rightium\*.* /ad /b > user.txt
type user.txt | find "JBSB" /v /i| find "BAK" /v /i > user2.txt
type nul > null.txt
fc null.txt user2.txt /n | find ":" > userlist.txt
if errorlevel 1 goto error2

:choose
echo The enterprise user codes found are below
echo --------------------------
type userlist.txt
echo.
echo --------------------------
echo Please choose an enterprise code, press Q to cancel:
choice /c:123456789q /n > nul
if errorlevel 10 goto end
for %%e in (1 2 3 4 5 6 7 8 9) do if errorlevel %%e set el=%%e

:generate
echo xset > userthis.bat
echo r cx > xset.asd
echo 5 >> xset.asd
echo w >> xset.asd
echo q >> xset.asd
debug userthis.bat nul

:convert
find "%el%: " > userthis.bat
echo set code=%%2> xset.bat
call userthis.bat

:check
if not exist %base%\Rightium\%code%\rightium.exe goto error3
if not exist %base%\Rightium\%code%\upgrade.ini goto extract
find "3.20.021" %base%\Rightium\%code%\upgrade.ini > nul
if not errorlevel 1 goto error4

:extract
echo.
echo Upgrading the software for the corresponding enterprise code......
if exist null.txt del null.txt
if exist user.txt del user.txt
if exist user2.txt del user2.txt
if exist userlist.txt del userlist.txt
if exist userthis.bat del userthis.bat
if exist xset.asd del xset.asd
if exist xset.bat del xset.bat
copy %temp%\rightium3\*.* %base%\Rightium\%code% > nul
if exist %base%\Rightium\%code%\up.bat del %base%\Rightium\%code%\up.bat
echo Upgrade complete, press any key to finish.
pause>nul
goto end

:error
:error1
echo.
echo Error: software installation path not found!
echo Hint: please make sure the software is installed.
echo.
goto restore
:error2
echo.
echo Error: enterprise user code directory not found!
echo Hint: please check whether the software is correct.
echo.
goto restore
:error3
echo.
echo Error: no valid files exist in the specified code directory!
echo Hint: please check whether the selected code is correct.
echo.
goto restore
:error4
echo.
echo Error: the specified code directory has already been upgraded!
echo Hint: please check whether the selected code is correct.
echo.
goto restore

:restore
set base=
set code=
set el=
pause>nul

:end
cls



※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 19 Posted 2004-01-26 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re pizigao:

This is the self-extracting file I made with WINRAR3, test it too.
Open attachment
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 20 Posted 2004-01-28 00:00 ·  中国 广东 广州 天河区 电信
初级用户
Credits 150
Posts 18
Joined 2003-10-13 00:00
22-year member
UID 11178
Gender Male
Status Offline
I wonder whether this brother works in technical development. For this kind of problem, you're still clinging stubbornly to DOS? Wouldn't it be enough to write a Windows upgrade program yourself? And in this situation you should definitely search the registry (provided your program stores the relevant information in the registry). Otherwise, on my machine there are more than a million files and folders, how long are you going to search?
Sigh, brother, hurry up and learn some things to enrich your knowledge :(
Floor 21 Posted 2004-01-28 00:00 ·  中国 江苏 扬州 电信
银牌会员
★★
三生缘里笑红尘
Credits 1,063
Posts 292
Joined 2003-03-09 00:00
23-year member
UID 1073
Gender Male
Status Offline
1. Thanks to brother willsort for the help, I'm testing it now. I'll let you know the test results in a few days. By the way, can it run normally on 2000 and XP? Thanks again to brother willsort.
2. RE: cavvie
Thanks for the advice, brother. I had considered that too, but at present I'm still building up my technical knowledge in that area! Thanks!
Floor 22 Posted 2004-01-28 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re pizigao:

The original program used the tool program choice.com, which is not provided by the NT series. If you copy this program from 98, it will cause 16-bit program compatibility problems. When I tested it under XP, I found that Chinese could not be used; under 98 there was no such problem.

Also, this program is only a prototype, so many complex details were omitted. For example, directory traversal, handling the case where there are more than 9 enterprise users, and so on.

In short, if you are only applying it in a non-professional setting, it can handle most problems. If you want to use it in commercial software, then there are still many shortcomings.

cavvie's view is also very useful: Windows problems are best solved using Windows's own methods. But if you solve it through the registry as cavvie said, there are also many problems: first, some commercial software, especially financial software, still only has a command-line version and does not access the registry at all; second, for cross-system use, registry technology still has many complicated details.

So, let me give you a suggestion. Looking at your upgrade package, I think it's not necessarily bad to do it this way. Since you've already decided to let the user choose, why not just use WINRAR's "browse files" to let the user choose their own upgrade path, at most adding detailed written instructions. That would actually be much simpler than using DOS batch files.



※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 23 Posted 2004-01-31 00:00 ·  中国 浙江 杭州 电信
银牌会员
★★
三生缘里笑红尘
Credits 1,063
Posts 292
Joined 2003-03-09 00:00
23-year member
UID 1073
Gender Male
Status Offline
Thanks willsort! I tested it yesterday under an XP system, and indeed the CHIOCE command cannot be used, but Chinese is supported.
Suggested modifications (without changing the overall idea, sorry to trouble big brother WILLSORT again):
1. Cancel the user selection menu, and instead directly search for enterprise-code directories that meet the condition (that is, the directory contains the RIGHTIUM.EXE program file), then display those matching enterprise-code directories in a list, telling the user to press any key to directly upgrade all matching enterprise-code directories (if done this way: 1. it can save the user from repeatedly operating the upgrade program when upgrading multiple enterprises; 2. it does not use the CHIOCE command, improving compatibility; 3. it breaks through the limitation of upgrading only 9 enterprises)
2. Leave the extraction package unchanged.
I would like to know what operation the following DEBUG commands perform?
=======================
echo xset > userthis.bat
echo r cx > xset.asd
echo 5 >> xset.asd
echo w >> xset.asd
echo q >> xset.asd
debug userthis.bat nul
=======================

Floor 24 Posted 2004-02-02 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re pizigao:

The overall idea is already there, it's just that I really can't find a machine to implement it specifically, and debugging in an Internet cafe is too slow.

First, use dir /s /ad to find the path of rightium, then extract all the numeric directories under it. After listing the directory table, ask whether to update, then use fc codelist null.txt /lb1 to loop and extract the first line of text into xset.bat, check that it is valid, and then perform the update operation. You can refer to the prototype program given in the previous example and the help documentation for fc to complete it. If you run into any problems, you can continue to contact me.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 25 Posted 2004-02-02 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re pizigao:

The Chinese problem on my xp appears after using 16-bit programs like debug or choice, and it seems to be some kind of settings problem. Not using debug seems to work too, it's just that I still haven't found the specific method, so you should still be careful when running it under xp.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 26 Posted 2004-02-03 00:00 ·  中国 浙江 杭州 电信
银牌会员
★★
三生缘里笑红尘
Credits 1,063
Posts 292
Joined 2003-03-09 00:00
23-year member
UID 1073
Gender Male
Status Offline
Thanks!
I ran into a problem while testing on my own machine: clearly my machine (98 system) has a RIGHTIUM directory, but running it gives an error (it seems like it can't find the directory). What causes this?
Floor 27 Posted 2004-02-03 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re pizigao:

The previous line says the environment variable space overflowed, but my program did not use too many environment variables, so that may be the result of the variable value being too long. In other words, the path where rightium is located is too deep.

It is also possible that the environment space of the batch file runtime environment is too small. You may refer to the following post to fix it:
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?BoardID=12&ID=8804&replyID=54137&skin=1
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 28 Posted 2004-02-04 00:00 ·  中国 浙江 杭州 电信
银牌会员
★★
三生缘里笑红尘
Credits 1,063
Posts 292
Joined 2003-03-09 00:00
23-year member
UID 1073
Gender Male
Status Offline
Thanks for the guidance
1. The RIGHTIUM directory is right under the root directory of drive C
2. The problem has already been solved
Forum Jump: