中国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-09-25 04:30
47,813 topics / 349,918 posts / today 1 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » [Repost and Improve] Teach You Step by Step to Write Batch Scripts
Printable Version  39,981 / 100
Floor16 sd_bob_chan Posted 2005-01-16 00:00
初级用户 Posts 9 Credits 127
I hope there will be more threads like this. That would really be a blessing for newbies like us.
Floor17 wlf2w Posted 2005-03-18 00:00
初级用户 Posts 14 Credits 137
Good stuff, collected
Floor18 stevenwong Posted 2005-08-24 12:13
新手上路 Posts 1 Credits 1
Floor19 ly Posted 2005-08-25 17:07
初级用户 Posts 7 Credits 40
What does lh mean?
cd\wps
spdos
py
wbx
In wps, what do spdos, py, and wbx mean? Thanks!
Floor20 willsort Posted 2005-08-25 21:10
元老会员 Posts 1,512 Credits 4,432
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 ]
Floor21 Climbing Posted 2005-08-25 22:30
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
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.
Floor22 goodball32 Posted 2005-10-07 22:28
新手上路 Posts 1 Credits 1
This article is top-grade!! Even though it's old, I'm bumping it!!
Floor23 chineseway Posted 2005-11-12 12:35
初级用户 Posts 18 Credits 35
2004111411335280.zip
File size: 126B
File type: WinRAR ZIP archive

After I downloaded it, it seems I can't open it?
Floor24 willsort Posted 2005-11-25 20:31
元老会员 Posts 1,512 Credits 4,432

Attachments
SBSBatch.zip (12.24 KiB)
Floor25 DaoDaoQQQ Posted 2005-11-25 20:53
初级用户 Posts 15 Credits 32
Great, this is just what I needed! Thanks.
Floor26 zhanglei200 Posted 2005-11-28 17:08
初级用户 Posts 8 Credits 36
Thank you so much, this is extremely useful to me
Floor27 lrb Posted 2005-12-21 15:45
初级用户 Posts 17 Credits 51
Great﹗Thanks﹗
Floor28 kilter Posted 2005-12-21 22:02
新手上路 Posts 4 Credits 16
Thanks
Floor29 xuhaibo307 Posted 2005-12-23 11:26
新手上路 Posts 1 Credits 2
Question: if it can run under WIN98, will it be the same under 2000/XP?
Floor30 slcsfk Posted 2006-03-06 17:30
新手上路 Posts 2 Credits 4 From df
Watching experts cross swords really is eye-opening!
Prev  1 2 3 4 5 … 7  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023