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-09-24 18:46
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Attention] Batch Processing Diagnosis Special Room View 18,438 Replies 172
Floor 151 Posted 2004-01-16 00:00 ·  中国 广东 佛山 南海区 电信
初级用户
Credits 114
Posts 3
Joined 2004-01-16 00:00
22-year member
UID 15646
Gender Male
Status Offline
Thanks
Floor 152 Posted 2004-01-25 00:00 ·  中国 陕西 渭南 电信
初级用户
Credits 122
Posts 5
Joined 2004-01-20 00:00
22-year member
UID 15869
Gender Male
Status Offline
Floor 153 Posted 2004-01-26 00:00 ·  中国 湖北 武汉 联通
银牌会员
★★★
Credits 1,681
Posts 512
Joined 2003-08-02 00:00
23-year member
UID 7953
Gender Male
Status Offline
Somehow somewhere I've got to choose.
No matter if it is win or lose.
Floor 154 Posted 2004-01-27 00:00 ·  中国 陕西 渭南 电信
初级用户
Credits 122
Posts 5
Joined 2004-01-20 00:00
22-year member
UID 15869
Gender Male
Status Offline
Floor 155 Posted 2004-01-31 00:00 ·  中国 云南 曲靖 电信
初级用户
Credits 105
Posts 1
Joined 2004-01-31 00:00
22-year member
UID 16394
Gender Male
Status Offline
Floor 156 Posted 2004-02-09 00:00 ·  中国 青海 西宁 电信
初级用户
Credits 157
Posts 11
Joined 2004-02-08 00:00
22-year member
UID 16934
Gender Male
Status Offline
I have a question about a batch file and would like to ask everyone.
> 1. if not exist c:\ucdos.bat goto win98
> ......
> etx cl198
> :wing98
> ......
> Among them: what does this line mean, etx cl198?
>
> 2. pause > nul
>
> Question: I remember that "pause" alone is enough for pausing. What does the following ">nul" mean?
>
> 3. mdir c:\ah /m /f5000000
> if errorlevel 1 goto inset1
> goto help
> :inset1
> ......
> Question: what do the last 2 parameters of the command that creates directory AH mean? What error is line 2 testing for, and is line 3 jumping
to the HELP section? I couldn't find the start of HELP in the whole batch file.
>
> 4. In a batch file, can .TXT and .xls documents be opened just like running .COM and .BAT?
> 5. In a batch file, is it possible to test whether a hard disk partition exists? Like in #1 where it tests whether a specified file exists, for example before executing
MD F:\HYQ, first test whether F exists?
> 6. Before I execute (by default) MD F:\HYQ, I want to give the user a prompt so the user can specify the directory
name, and then use that directory name in the following commands. It's a bit like entering a string from the keyboard in C. Can this be done in a batch file? How do I write it?

Especially questions 5 and 6?
Floor 157 Posted 2004-02-12 00:00 ·  中国 青海 西宁 电信
初级用户
Credits 157
Posts 11
Joined 2004-02-08 00:00
22-year member
UID 16934
Gender Male
Status Offline
Why is nobody here???????????????
Floor 158 Posted 2005-01-08 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
This is a *.bat file I wrote by copying the example in a book, but it gives an error when run.
Please help me take a look


@echo off
choice /c:mde mem,defrag,end
if errorlevel 3 goto mem(you should test the highest error code value first)
if errorlevel 2 goto defrag
if errotlevel 1 goto end

:mem
mem
goto end
:defrag
c:\windows\defrag.exe
goto end
:end
echo good bye

@echo off
choice /c:mde mem,defrag,end
if errorlevel 3 goto end(you should test the highest error code value first)
if errorlevel 2 goto defrag
if errotlevel 1 goto mem
:mem
mem
goto end
:defrag
c:\windows\defrag.exe
goto end
:end
echo good bye
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Floor 159 Posted 2005-01-08 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
The following is quoted from iceboy's post on 2003-10-6 15:42:54:
Yes! The simplest method is to use Choice.com; if you want something more complicated, use Menustar or ChoiceX, or just write a small program too.


We found that all of you have gotten the CHOICE method wrong!!! If something goes wrong, I won't take responsibility
@echo off
f:\pillow\dos\tw.exe
set path=f:\pillow\dos;e:\ghost
echo.
echo MS-DOS 7.10 boot menu
echo.
echo 1. Boot to DOS
echo 2. Back up system
echo 3. Restore system
echo.
choice /c:123 /n /t:1,30 Please choose:
if errorlevel 3 goto DOS
if errorlevel 2 goto BACKUP
if errorlevel 1 goto RESTORE
OS
goto exit
:BACKUP
ghost -clone,mode=pdump,src=1:1,dst=e:\ghost\win2k_1.gh1 -fx -rb
goto exit
:RESTORE
ghost -clone,mode=pload,src=e:\ghost\win2000.gh1,dst=1:1 -rb
:exit
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Floor 160 Posted 2005-01-09 00:00 ·  中国 广东 潮州 电信
初级用户
Credits 102
Posts 19
Joined 2004-11-22 00:00
21-year member
UID 33910
Gender Male
Status Offline
set LglDrv=27 * 26 Z 25 Y 24 X 23 W 22 V 21 U 20 T 19 S 18 R 17 Q 16 P 15
set LglDrv=%LglDrv% O 14 N 13 M 12 L 11 K 10 J 9 I 8 H 7 G 6 F 5 E 4 D 3 CThe meaning above is to assign all the characters after the equals sign "=" to the variable %LglDrv%.
Floor 161 Posted 2005-02-13 00:00 ·  中国 福建 泉州 电信
初级用户
Credits 154
Posts 15
Joined 2005-01-31 00:00
21-year member
UID 35835
Gender Male
Status Offline
This post is really great and very valuable as a reference. It ought to be moved to the front, bump!!!
Floor 162 Posted 2005-04-23 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
Verifying the "Godd Bach" conjecture (please add odd numbers)
:: Solve.bat - program for verifying Goldbach's conjecture
:: Will Sort - 2004/11/18
::
:: Modified from a prime-number piling program
:: Environment variable notes:
:: iTest: test number, iPrime: prime number index
:: divisor: divisor used to test primes, iDivisor: divisor index
:: Factor1&Factor2: the two factors of the even number, iFactor1&iFicator2: factor indices
:: less: marker for not enough to divide in division, diff: marker for a difference value in subtraction
::
@echo off
if == goto %2
if == %comspec% /e:4096 /c %0 $ init
del ~Solve.bat
goto end

:: Initialization: generate prime 2, store it as the first prime, set the loop starting value to 3
:init
set iTest=I I
set iPrime=I
set %iPrime%=I I

:: For odd numbers %iTest% from 3~n, divide them by all generated primes from small to large in a loop
:: If none divide evenly then store %iTest% as prime %iPrime%, otherwise jump to Solve
:: Decompose each even number %iTest% from 3~n into the sum of two generated primes
:: If decomposed exactly then display this even number and the two factors, otherwise continue looping MainLoop
:MainLoop
rime - test whether an odd number is prime
set iTest=I %iTest%
set iDivisor=I
rimeLoop
echo set divisor=%%%iDivisor%%%>~Solve.bat
call ~Solve.bat
call %0 $ Divide %iTest%
if "%less%"=="" goto Solve
if "%iDivisor%"=="%iPrime%" goto IsPrime
set iDivisor=I%iDivisor%
goto PrimeLoop
:IsPrime
set iPrime=I%iPrime%
set %iPrime%=%iTest%
:Solve - decompose an even number into the sum of primes
set iTest=I %iTest%
set iFactor1=
:SolveLoop
set iFactor1=I%iFactor1%
if "%iFactor1%"=="I%iPrime%" goto SolveLoop
set iFactor2=%iFactor1%
:SolveSubLoop
if "%iFactor2%"=="I%iPrime%" goto SolveLoop
echo set Factor1=%%%iFactor1%%%> ~Solve.bat
echo set Factor2=%%%iFactor2%%%>>~Solve.bat
call ~Solve.bat
call %0 $ Minus %iTest%
if "%diff%"=="" goto IsSolve
set iFactor2=I%iFactor2%
goto SolveSubLoop
:IsSolve
echo %iTest%
echo %Factor1% + %Factor2%
if "%iPrime%"=="IIIIIIIII" goto end
goto MainLoop

:: Divide the passed dividend %iTest% by the divisor %divisor% (repeated subtraction)
:: If it is not enough to divide (cannot divide evenly) then return the not-enough signal less, otherwise return directly
ivide
for %%n in (%divisor%) do shift
if not == goto Divide
set less=
if == set less=true
goto end

:: Subtract the subtrahends %Factor1% and %Factor2% from the passed minuend %iTest%
:: If there is a difference left (cannot be decomposed) then return the difference signal diff, otherwise return directly
:Minus
for %%n in (%Factor1%) do shift
for %%n in (%Factor2%) do shift
set diff=
if "%2"=="" set diff=true
if not "%3"=="" set diff=true
goto end

:end
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Floor 163 Posted 2005-04-23 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
I got it, but I can't understand it
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Floor 164 Posted 2005-04-23 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
Use 【code】【/code】 (the English ones; right now I can only write them in Chinese) to enter indented text
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Floor 165 Posted 2005-04-23 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
If you want to ask, go find willsort. She's very familiar with this, a batch file expert
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Forum Jump: