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-07-01 19:28
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » I searched but didn't find the answer. How to judge which number is larger under DOS View 3,125 Replies 14
Original Poster Posted 2007-08-19 00:54 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
I am under the environment of DOS 7.1

::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Name: size_for.bat
::Usage: call size_for.bat %1
::Parameter: %1 is the size of the partition
::Function: Judge the partition of the hard disk. If it is greater than 4500, output "/NTFS"; if less than 4500, output "/-32"
::By: Xiao Chen Gongzi
::QQ: 24070970
::Website: http://www.Y8Y8.com
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set size=%1
set form=

if %size% GTR 4500 set form="/NTFS"


echo form = %form%



When I execute it, it prompts: syntax error

Which expert can help me give some pointers?

Thank you

[ Last edited by ww111222 on 2007-8-19 at 12:10 PM ]
Floor 2 Posted 2007-08-19 11:22 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
You just look at how much the difference is between if /? in command and if /? in cmd
Floor 3 Posted 2007-08-19 12:09 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
I'm under DOS 7.1, really can't figure it out
Floor 4 Posted 2007-08-19 12:11 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Because DOS has no comparison command at all.
Floor 5 Posted 2007-08-19 19:17 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
Originally posted by knoppix7 at 2007-8-19 12:11 PM:
Because DOS has no comparison command at all.




Thank you. It seems a bit difficult.



Can't handle it, I won't eat.
Floor 6 Posted 2007-08-19 19:56 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Floor 7 Posted 2007-08-20 22:47 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
I've been looking up information for many days, but I still can't find the answer.

The environment is: MSDOS7.1 environment,
Floor 8 Posted 2007-08-20 23:40 ·  中国 中电华通
初级用户
★★
Credits 183
Posts 82
Joined 2006-03-28 21:18
20-year member
UID 52959
Status Offline
The program of strings.com, for example, to judge the size of variables %a% and %b%: strings xx=sub %a%,%b%, and judge through errorlevel
Floor 9 Posted 2007-08-21 00:20 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
Floor 10 Posted 2007-08-21 17:09 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
Originally posted by zhangxue at 2007-8-20 11:40 PM:
For the strings.com program, for example, to determine the size of variables %a% and %b%: strings xx=sub %a%,%b%, and determine through errorlevel.


Hello, can you give a hint?
Floor 11 Posted 2007-08-21 18:21 ·  中国 中电华通
初级用户
★★
Credits 183
Posts 82
Joined 2006-03-28 21:18
20-year member
UID 52959
Status Offline
strings m=sub %a%,%b%
if errorlevel 1 echo %a% is less than %b%

#The rule is like this: if the previous number is greater than the next number, the result of subtraction is assigned to variable m
#If the previous number is less than the next number, it will return errorlevel 1
Floor 12 Posted 2007-08-21 18:22 ·  中国 中电华通
初级用户
★★
Credits 183
Posts 82
Joined 2006-03-28 21:18
20-year member
UID 52959
Status Offline
1. STRINGS [Target variable=]LEFT Source string Number of characters to take 〈Take the specified number of characters from the left of the source string〉
2. STRINGS [Target variable=]RIGHT Source string Number of characters to take 〈Take the specified number of characters from the right of the source string〉
3. STRINGS [Target variable=]MID Source string Start number, End number 〈Take from the center of the source string〉
4. STRINGS [Target variable=]LENGTH Source string 〈Return the character length of the source string〉
5. STRINGS [Target variable=]FIND Source string Character 〈Find the specified character from the source string〉
6. STRINGS [Target variable=]FINDC Source string Character 〈Find the specified character from the source string, case-sensitive〉
7. STRINGS [Target variable=]LOWER Source string 〈Convert uppercase letters in the source string to lowercase letters〉
8. STRINGS [Target variable=]UPPER Source string 〈Convert lowercase letters in the source string to uppercase letters〉
9. STRINGS [Target variable=]CHAR Character [Character1] [Character2]... 〈Convert characters to ASCII numbers〉
10. STRINGS [Target variable=]VAL Number [Number1] [Number2]... 〈Convert numbers to ASCII characters〉
11. STRINGS [Target variable=]FILEDRIVE File name 〈Return the drive letter where the file name is located〉
12. STRINGS [Target variable=]FILEDIR File name 〈Return the directory where the file name is located〉
13. STRINGS [Target variable=]FILENAME Source file name 〈Return the file name of the source file name, without the extension〉
14. STRINGS [Target variable=]FILEEXT Source file name 〈Return only the extension of the source file name〉
15. STRINGS [Target variable=]ADDCOMMAS Number 〈Separate the number with commas every three digits〉
16. STRINGS [Target variable=]REPEAT Number of repetitions, Character or number 〈Repeat the character or number as specified〉
17. STRINGS [Target variable=]READ File name, Line number 〈Read the content of the specified line in the file〉
18. STRINGS [Target variable=]WRITE File name, Character 〈Append the character to the file〉
19. STRINGS [Target variable=]FILESIZE File name 〈Return the size of the file〉
20. STRINGS [Target variable=]LINESIZE File name 〈Return the total number of lines in the file content〉
21. STRINGS [Target variable=]TRUENAME File name 〈Return the full path of the file〉
22. STRINGS [Target variable=]FILEDATE File name 〈Return the modification date of the file〉
23. STRINGS [Target variable=]FILETIME File name 〈Return the modification time of the file〉
24. STRINGS [Target variable=]VER 〈Return the current system's DOS version number〉
25. STRINGS [Target variable=]ASK Prompt string [, Maximum input number] [, 1=* display 2=not display] 〈Dialogue〉
26. STRINGS [Target variable=]INWIN 〈Return 1 if running in the DOS window in WINDOWS〉
27. STRINGS [Target variable=]ENVFREE 〈Return the free bytes of the environment variable space〉
28. STRINGS [Target variable=]ENVSIZE 〈Return the total size of the environment variable space〉
29. STRINGS [Target variable=]TRUEVER 〈Return the true version number of the current DOS〉
30. STRINGS [Target variable=]FILES 〈Return the number of files currently accessed simultaneously〉
31. STRINGS [Target variable=]LASTDRIVE 〈Return the last valid drive letter that the current system can access〉
32. STRINGS [Target variable=]CODEPAGE 〈Return the active long file code page of the current system〉
33. STRINGS [Target variable=]COUNTRY 〈Return the country code set by the current system〉
34. STRINGS [Target variable=]BIOSDATE 〈Return the date of BIOS factory〉
35. STRINGS [Target variable=]GETKEY 〈Return the ASCII code of the key pressed〉
36. STRINGS [Target variable=]ADD Number1, Number2 [, Number3]... 〈Perform + operation on numbers〉
37. STRINGS [Target variable=]SUB Number1, Number2 [, Number3]... 〈Perform - operation on numbers〉
38. STRINGS [Target variable=]MUL Number1, Number2 [, Number3]... 〈Perform × operation on numbers〉
39. STRINGS [Target variable=]DIV Number1, Number2 [, Number3]... 〈Perform ÷ operation on numbers〉
40. STRINGS [Target variable=]AND Number1, Number2 [, Number3]... 〈Perform "logical AND" operation on numbers〉
41. STRINGS [Target variable=]OR Number1, Number2 [, Number3]... 〈Perform "logical OR" operation on numbers〉
42. STRINGS [Target variable=]NOT Number1, Number2 [, Number3]... 〈Perform "logical NOT" operation on numbers〉
43. STRINGS [Target variable=]MEMTOTAL 〈Return the total amount of conventional memory in the system〉
44. STRINGS [Target variable=]MEMFREE 〈Return the free amount of conventional memory in the system〉
45. STRINGS [Target variable=]XMSTOTAL 〈Return the total amount of extended memory in the system〉
46. STRINGS [Target variable=]XMSFREE 〈Return the free amount of extended memory in the system〉
47. STRINGS [Target variable=]XMSVER 〈Return the version number of the driver program currently using extended memory〉
48. STRINGS [Target variable=]EMSTOTAL 〈Return the total amount of expanded memory in the system〉
49. STRINGS [Target variable=]EMSFREE 〈Return the free amount of expanded memory in the system〉
50. STRINGS [Target variable=]EMSVER 〈Return the version number of the driver program currently using expanded memory〉
51. STRINGS [Target variable=]STRINGSVER 〈Return the version number of STRINGS〉
Floor 13 Posted 2007-08-21 18:46 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
Floor 14 Posted 2007-08-21 21:09 ·  中国 中电华通
初级用户
★★
Credits 183
Posts 82
Joined 2006-03-28 21:18
20-year member
UID 52959
Status Offline
set form=/-32
strings mm=sub %1,4500>nul
if not errorlevel 1 set form=/NTFS
Attachments
STRINGS.rar (8.55 KiB, Downloads: 106)
Floor 15 Posted 2007-08-21 21:54 ·  中国 新疆 塔城地区 电信
中级用户
★★
Credits 354
Posts 83
Joined 2003-03-23 00:00
23-year member
UID 1232
Gender Male
Status Offline
Originally posted by zhangxue at 2007-8-21 09:09 PM:
set form=/-32
strings mm=sub %1,4500>nul
if not errorlevel 1 set form=/NTFS


Thank you. I saw that this brother has replied to this post of mine on the forum (including other forums),

I am very moved,

No way to repay, come to Xinjiang. Tacheng, I treat you to a meal
Forum Jump: