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-06-22 13:39
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Repost and Improve] Teach You Step by Step to Write Batch Scripts DigestI View 37,627 Replies 100
Floor 16 Posted 2005-01-16 00:00 ·  中国 广东 东莞 电信
初级用户
Credits 127
Posts 9
Joined 2005-01-14 00:00
21-year member
UID 35335
Gender Male
Status Offline
I hope there will be more threads like this. That would really be a blessing for newbies like us.
Floor 17 Posted 2005-03-18 00:00 ·  中国 福建 莆田 电信
初级用户
Credits 137
Posts 14
Joined 2005-03-08 00:00
21-year member
UID 36818
Gender Male
Status Offline
Good stuff, collected
Floor 18 Posted 2005-08-24 12:13 ·  中国 中移铁通
新手上路
Credits 1
Posts 1
Joined 2005-08-24 11:32
20-year member
UID 41896
Gender Male
Status Offline
Floor 19 Posted 2005-08-25 17:07 ·  中国 山西 太原 联通
初级用户
Credits 40
Posts 7
Joined 2005-08-24 09:23
20-year member
UID 41891
Gender Male
Status Offline
What does lh mean?
cd\wps
spdos
py
wbx
In wps, what do spdos, py, and wbx mean? Thanks!
Floor 20 Posted 2005-08-25 21:10 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re ly:

lh is an internal DOS command. Its alias is LoadHigh, that is, load the specified program into DOS high memory as much as possible (High Memeory Area, HMA)

----------------------------------------------------------------------------

LOADHIGH (LH)

Loads a program into upper memory. Loading a program into upper memory can preserve more conventional memory space for
other programs to use (for information about memory optimization, see the chapter "Making More Memory Available"
in the MS-DOS 6.22 User's Guide).

Syntax

LOADHIGH filename

To specify the memory area into which the program should be loaded, use the following syntax:


LOADHIGH ...] ]
filename

LOADHIGH can be abbreviated as LH.

Switches

/L:region1...]

Specifies the memory region into which to load the program. If /L is not used, MS-DOS loads the program into the largest free upper memory block
(UMB), and makes other available UMBs available to the program. /L can be used to specify a particular memory region into which the program is loaded or
memory regions the program can use.

Specifying a region number after the /L switch causes the program to be loaded into the largest free memory block in the specified region. For example, to
load a program into the largest free memory block in region 4, enter /L:4 (the MEM /F command line can list free
memory regions).

When using the /L switch, the program can use only the specified memory regions. For programs that use multiple memory regions,
multiple regions can be specified (using the MEM /M command with the program name as a parameter lets you view the program's memory usage).
When multiple regions are specified, separate the memory block numbers with semicolons (;). For example, to use memory blocks 2 and 3, enter
/L:2 ; 3 .

Normally, MS-DOS loads the program into the specified upper memory region containing a UMB larger than the program's load size (the program's load
size is usually equal to the size of the executable file). If the program needs more space when running than its load
size, you can use the minsize parameter to make sure the program is not loaded into a UMB smaller than the space it needs at run time. MS-DOS will load the program
into a UMB larger than both the program's load size and the size specified by minsize.

/S
Shrinks the UMB to the minimum size when loading the program. Using this switch makes memory use most efficient. This switch is usually
used only by the MemMaker program. MemMaker can analyze a program's memory usage to determine whether it is safe to use
this switch when loading the program. This switch can only be used together with the /L switch, and affects only UMBs for which a minimum size has been specified.


Parameters

filename
Specifies the location and name of the program to load.

parameters
Specifies the command-line parameters required by the program.

Related commands

For information about loading device drivers into upper memory, see the <DEVICEHIGH> command.

For information about using MemMaker to move programs to upper memory, see the <MEMMAKER> command.



Example Syntax
----------------------------------------------------------------------------

LOADHIGH (LH)─Notes

Requires the DOS=UMB command

Before using the LOADHIGH command, you must add the DOS=UMB command to the COMFIG.SYS file. For more
information about the DOS=UMB command, see the <DOS> command.

Use MemMaker to optimize upper memory automatically

MS-DOS 6.22 includes the MemMaker program, which can automatically optimize system memory usage. MemMaker scans
upper memory and analyzes the memory usage of drivers and applications to determine which programs are best suited for loading into available
UMBs. MemMaker adds LOADHIGH commands to the AUTOEXEC.BAT file, and specifies /L and /S switches when necessary. For more
information about MemMaker, see the chapter "Making More Memory Available" in the MS-DOS 6.22 User's Guide.

An upper memory manager must be installed

Before programs can be loaded into upper memory, an upper memory manager must be installed. MS-DOS provides EMM386.EXE for 80386
or higher computers to manage upper memory. EMM386 can be installed with the DEVICE command in the CONFIG.SYS file
(the DEVICE command to install the HIMEM.SYS extended memory manager must come before the DEVIECE command that installs EMM386)

How LOADHIGH works

When loading a program with LOADHIGH, MS-DOS tries to load the program into upper memory. If upper memory
is insufficient, MS-DOS loads the program into conventional memory. Using the MEM /M command and specifying the program name lets you determine
whether the program is using a UMB.

Using LOADHIGH in the AUTOEXEC.BAT file

The most convenient way to use the LOADHIGH command is in AUTOEXEC.BAT. (If the
MemMaker program is used, it will automatically add the required LOADHIGH commands to the AUTOEXEC.BAT file.)

Syntax Notes
----------------------------------------------------------------------------

LOADHIGH (LH)─Examples

The following command line loads the DOSKEY program into upper memory and specifies that MS-DOS load the program into memory region 1:

loadhigh /l:1 c:\dos\doskey

The following command line loads the program MYPROG.EXE into memory region 1, and allows the program to use upper memory regions 3 and 4:

lh /L:1;3;4 c:\programs\myprog.exe

The following command line loads MYPROG into conventional memory (region 0) and allows the program to access upper memory region 1:

loadhigh /l:0;1 c:\programs\myprog.exe




As for SPDOS, it was an early Chinese-language platform bundled together with WPS, similar to UCDOS, TWAY, CCDOS, etc. PY and WBX are respectively its Pinyin and Wubi input method loading programs.

Re Climbing:

It seems necessary to revise some of those example programs.

[ Last edited by willsort on 2005-8-26 at 14:52 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 21 Posted 2005-08-25 22:30 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
Re willsort:

Since I revised this on the basis of someone else's article, the overall tone was set by the original article (I was only correcting some errors). Originally this example should have been a very common one—people who worked with DOS in the early days all knew what was going on—and this example was only meant to show what batch files are for (executing a batch of commands sequentially in one go). But this comrade insists on getting to the bottom of everything, so we can only deal with it step by step. Actually, his other questions belong to the basic DOS category and are outside the scope of discussion in this thread. Because generally speaking, if you want a better understanding of batch files, the prerequisite is to have a certain understanding of the DOS command-line method; you can't learn to run before you've learned to walk.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 22 Posted 2005-10-07 22:28 ·  中国 广东 茂名 电信
新手上路
Credits 1
Posts 1
Joined 2005-10-07 22:18
20-year member
UID 43207
Status Offline
This article is top-grade!! Even though it's old, I'm bumping it!!
Floor 23 Posted 2005-11-12 12:35 ·  中国 福建 福州 联通
初级用户
Credits 35
Posts 18
Joined 2005-07-17 17:19
20-year member
UID 40810
Status Offline
2004111411335280.zip
File size: 126B
File type: WinRAR ZIP archive

After I downloaded it, it seems I can't open it?
Floor 24 Posted 2005-11-25 20:31 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Attachments
SBSBatch.zip (12.24 KiB, Credits to download 1 pts, Downloads: 726)
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 25 Posted 2005-11-25 20:53 ·  中国 广西 贺州 电信
初级用户
Credits 32
Posts 15
Joined 2005-10-30 18:46
20-year member
UID 44308
Status Offline
Great, this is just what I needed! Thanks.
Floor 26 Posted 2005-11-28 17:08 ·  中国 河北 唐山 联通
初级用户
Credits 36
Posts 8
Joined 2005-11-27 11:39
20-year member
UID 46029
Gender Male
Status Offline
Thank you so much, this is extremely useful to me
Floor 27 Posted 2005-12-21 15:45 ·  中国 广东 东莞 电信
初级用户
Credits 51
Posts 17
Joined 2005-09-19 14:53
20-year member
UID 42632
Gender Male
Status Offline
Great﹗Thanks﹗
Floor 28 Posted 2005-12-21 22:02 ·  中国 福建 厦门 联通
新手上路
Credits 16
Posts 4
Joined 2005-12-21 21:43
20-year member
UID 47623
Gender Male
Status Offline
Thanks
Floor 29 Posted 2005-12-23 11:26 ·  中国 湖南 长沙 电信
新手上路
Credits 2
Posts 1
Joined 2005-12-21 16:49
20-year member
UID 47608
Status Offline
Question: if it can run under WIN98, will it be the same under 2000/XP?
Floor 30 Posted 2006-03-06 17:30 ·  中国 山东 济宁 联通
新手上路
Credits 4
Posts 2
Joined 2006-03-06 16:46
20-year member
UID 51485
Gender Male
From df
Status Offline
Watching experts cross swords really is eye-opening!
Forum Jump: