中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-19 01:21
47,814 topics / 349,908 posts / today 1 new / 48,259 members
DOS批处理 & 脚本技术(批处理室) » I searched but didn't find the answer. How to judge which number is larger under DOS
Printable Version  3,220 / 14
Floor1 ww111222 Posted 2007-08-19 00:54
中级用户 Posts 83 Credits 354
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 ]
Floor2 knoppix7 Posted 2007-08-19 11:22
银牌会员 Posts 634 Credits 1,287 From cmd.exe
You just look at how much the difference is between if /? in command and if /? in cmd
Floor3 ww111222 Posted 2007-08-19 12:09
中级用户 Posts 83 Credits 354
I'm under DOS 7.1, really can't figure it out
Floor4 knoppix7 Posted 2007-08-19 12:11
银牌会员 Posts 634 Credits 1,287 From cmd.exe
Because DOS has no comparison command at all.
Floor5 ww111222 Posted 2007-08-19 19:17
中级用户 Posts 83 Credits 354
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.
Floor6 knoppix7 Posted 2007-08-19 19:56
银牌会员 Posts 634 Credits 1,287 From cmd.exe
Floor7 ww111222 Posted 2007-08-20 22:47
中级用户 Posts 83 Credits 354
I've been looking up information for many days, but I still can't find the answer.

The environment is: MSDOS7.1 environment,
Floor8 zhangxue Posted 2007-08-20 23:40
初级用户 Posts 82 Credits 183
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
Floor9 ww111222 Posted 2007-08-21 00:20
中级用户 Posts 83 Credits 354
Floor10 ww111222 Posted 2007-08-21 17:09
中级用户 Posts 83 Credits 354
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?
Floor11 zhangxue Posted 2007-08-21 18:21
初级用户 Posts 82 Credits 183
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
Floor12 zhangxue Posted 2007-08-21 18:22
初级用户 Posts 82 Credits 183
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〉
Floor13 ww111222 Posted 2007-08-21 18:46
中级用户 Posts 83 Credits 354
Floor14 zhangxue Posted 2007-08-21 21:09
初级用户 Posts 82 Credits 183
set form=/-32
strings mm=sub %1,4500>nul
if not errorlevel 1 set form=/NTFS

Attachments
STRINGS.rar (8.55 KiB)
Floor15 ww111222 Posted 2007-08-21 21:54
中级用户 Posts 83 Credits 354
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
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023