· 9 years ago · Nov 19, 2016, 02:10 AM
1View in RAW:
2 _ _ _ _ _____ ____ _____ _ _ __ __ ______ _ _ _______ ______ _____
3 | | | | \ | | __ \ / __ \ / ____| | | | \/ | ____| \ | |__ __| ____| __ \
4 | | | | \| | | | | | | | | | | | | \ / | |__ | \| | | | | |__ | | | |
5 | | | | . ` | | | | | | | | | | | | |\/| | __| | . ` | | | | __| | | | |
6 | |__| | |\ | |__| | |__| | |____| |__| | | | | |____| |\ | | | | |____| |__| |
7 \____/|_|_\_|_____/_\____/ \_____|\____/|_|__|_|______|_|_\_|_ |_| _|______|_____/
8 | \/ |/ ____| | __ \ / __ \ / ____| / / ____| \/ | __ \
9 | \ / | (___ ______| | | | | | | (___ / / | | \ / | | | |
10 | |\/| |\___ \______| | | | | | |\___ \ / /| | | |\/| | | | |
11 | | | |____) | | |__| | |__| |____) / / | |____| | | | |__| |
12 |_| |_|_____/___ _|_____/_\____/|_____/_/ \_____|_| _|_|_____/
13 / ____/ __ \| \/ | \/ | /\ | \ | | __ \ / ____|
14 | | | | | | \ / | \ / | / \ | \| | | | | (___
15 | | | | | | |\/| | |\/| | / /\ \ | . ` | | | |\___ \
16 | |___| |__| | | | | | | |/ ____ \| |\ | |__| |____) |
17 \_____\____/|_| |_|_| |_/_/ \_\_| \_|_____/|_____/
18
19Contents:
20
21- TRUENAME
22- FDISK /STATUS
23- FDISK /MBR
24- SHELL=C:\COMMAND.COM /P /F
25- COMMAND /F
26- COMMAND /P
27- COMMAND /D
28- VER /R
29- ECHO OFF and ECHO ON
30- FORMAT /AUTOTEST
31- FORMAT /BACKUP
32- FORMAT /SELECT
33- FORMAT /SELECT /U
34- FORMAT /H
35- IF EXIST <dirname>\NUL <command> and IF EXIST EMMXXXX0 <command>
36- Using ATTRIB to hide directories
37- SWITCHES=/W
38- FOR %%V IN (/SOMETHING)
39- DIR,
40- COPY. A:
41- DOS?=HIGH
42- INSTALLHIGH
43- Using : for batch file comments
44- REM in lines with pipes or redirection
45- Delimiter character
46
47===========================================================================
48 TRUENAME
49 --------
50
51Internal DOS 5.0 command. Canonicalize a filename or path (using DOS interrupt 21h, function 60) prints the actual directory.
52
53 Syntax:
54
55 TRUENAME filename - Prints the complete path to file.
56 TRUENAME directory - Prints the complete path to directory.
57
58Note: If the path is in a network, it starts with a \\machine-name.
59
60TRUENAME is analogous to the UNIX "whence" command. It returns the real fully-qualified path name for a command.
61
62TRUENAME is useful in networks, where a physical drive may be mapped to a logical volume, and the user needs to know the physical location of the file. It ignores the DOS SUBST and JOIN commands, or network MAPped drives.
63
64TRUENAME is an undocumented MS-DOS feature, but it is documented in JP Software's 4DOS software (COMMAND.COM replacement) as follows:
65
66 Syntax:
67
68 TRUENAME [d:][path]filename
69
70 Purpose:
71
72 Returns a fully qualified filename.
73
74 Comments:
75
76 TRUENAME will see "through" JOIN and SUBST commands, and
77 requires MS-DOS 3.0 or above.
78
79 Example:
80
81 The following command uses TRUENAME to get the true pathname
82 for a file:
83
84 c:\>subst d: c:\util\test
85 c:\>truename d:\test.exe
86
87 c:\util\test\test.exe
88
89TRUENAME : will reveal the full name drive and path of the filename. If you specify a wildcard (*) in the filename, it will expand the filename to use question marks instead. If the path includes the ..\ sequence, TRUENAME will examine the directory structure and calculate the path.
90
91Stranger still, the line:
92
93 TRUENAME \CRONK\FLIBBET\..\ART
94
95...produces the response:
96
97 C:\CRONK\ART
98
99...even if the directories \CRONK\FLIBBET and the file ART don't exist! Don't expect this command to work well across networks. After all, this is still undocumented in MS-DOS for a reason!
100
101===========================================================================
102 FDISK /STATUS
103 -------------
104
105Prints a screen just like using option 4 of FDISK, "Partition information", but includes extended partition information. Nice if you want to get an overview without fear of pressing the wrong keys.
106
107Doesn't work in DOS 3.30.
108
109===========================================================================
110 FDISK /MBR
111 ----------
112
113MS-DOS 5.0 FDISK has an undocumented parameter, /MBR, that causes it to write the master boot record to the hard disk without altering the partition table information. While this feature is not documented, it can be told to customers on a need-to-know basis.
114
115Warning: Writing the master boot record to the hard disk in this manner can make certain hard disks partitioned with SpeedStor unusable. It can also cause problems for some dual-boot programs, or for disks with more than 4 partitions. Specific information is below.
116
117What is the MBR?
118
119At the end of the ROM BIOS bootstrap routine, the BIOS will read and execute the first physical sector of the first floppy or hard drive on the system. This first sector of the hard disk is called the master boot record, or sometimes the partition table or master boot block. At the beginning of this sector of the hard disk is a small program. At the end of this sector is where the partition information, or partition table, is stored. This program uses the partition information to determine which partition is bootable (usually the first primary DOS partition) and attempts to boot from it.
120
121This program is what is written to the disk by FDISK /MBR and is usually called the master boot record. During normal operation, FDISK only writes this program to the disk if there is no master boot record.
122
123Why is the MBR changed during Setup?
124
125During installation of Microsoft MS-DOS 5 Upgrade, Setup will replace the master boot record on the hard disk with code to display the message:
126
127 The MS-DOS 5.0 Setup was not completed.
128 Insert the UNINSTALL #1 diskette in drive A.
129 Press the ENTER key to continue.
130
131This message should be erased and the master boot code rewritten before Setup is completed. If a problem occurs during Setup and you return to the previous MS-DOS, UNINSTAL should also remove this message. However, should Setup or UNINSTAL fail to remove this message, or should the master boot record become corrupted, a new master boot record can be written to the disk using the following command:
132
133 C:\>fdisk /mbr
134
135 WARNINGS:
136
137 This option should not be used if:
138
139 - the disk was partitioned using Storage Dimensions'
140 SpeedStor utility with its /Bootall option
141 - more than 4 partitions exist
142 - certain dual-boot programs are in use
143
144Storage Dimensions' SpeedStor utility using the /Bootall option redefines the drive's physical parameters (cylinder, head, sector). /BOOTALL stores information on how the drive has been changed in an area of the master boot record that MS-DOS does not use. FDISK /MBR will erase that information, making the disk unusable.
145
146Some older OEM versions of MS-DOS and some third-party partitioning utilities can create more than 4 partitions. Additional partition information is commonly stored information on partitions in an area that FDISK /MBR will overwrite.
147
148Some dual-boot programs have a special MBR that asks the user which operating system they want on bootup. FDISK /MBR erases this program. Dual-boot systems that boot whichever partition is marked Active are not affected by FDISK /MBR.
149
150If you have a Boot Sector Virus, just boot from a known "clean" floppy disk that's write protected and which has FDISK on it, and run FDISK /MBR.
151
152===========================================================================
153 SHELL=C:\COMMAND.COM /P /F
154 --------------------------
155
156The /F in the CONFIG.SYS SHELL= statement forces a "Fail" response to all "Abort, Retry, Fail" prompts issued by the DOS critical error handler.
157
158===========================================================================
159 COMMAND /F
160 ----------
161
162Entered on the command line, COMMAND /F makes all those annoying "Abort, Retry, Ignore, Fail" disk error messages default to "Fail" from then on until rebooting.
163
164===========================================================================
165 COMMAND /P
166 ----------
167
168For DOS 3.30 (not checked with other versions): Docs say that this doesn't allow you to exit back to the previous shell, but /P also forces AUTOEXEC.BAT to be run on secondary shells.
169
170===========================================================================
171 COMMAND /D
172 ----------
173
174When used with a primary shell, or secondary with /P, prevents execution of AUTOEXEC.BAT.
175
176===========================================================================
177 VER /R
178 ------
179
180Yields extended information about the DOS version:
181
182 MS-DOS Version 5.00
183 Revision A
184 DOS is in HMA
185
186Doesn't work with DOS 3.30. VER /R is a documented feature of JP Software's 4DOS.
187
188===========================================================================
189 ECHO OFF and ECHO ON
190 --------------------
191
192Entering ECHO OFF from the command line erases the prompt and leaves just a cursor on the screen. ECHO ON from the command line restores the prompt. This works with all version of DOS.
193
194One of the most frequently asked questions is "How do I ECHO a blank line in a batch file?" The most common answer is to use ECHO directly followed by a period: ECHO. like so. However, just about any "white space" character will work, as well as any "delimiter". The following alternatives can be used: ECHO. ECHO" ECHO, ECHO: ECHO; ECHO[ ECHO] etc. Apparently it's just the way that the command handles the delimiter and has been available from way back! Microsoft just began mentioning it in the documentation recently, though, and their examples use a period.
195
196===========================================================================
197 FORMAT /AUTOTEST
198 ----------------
199
200The autotest parameter will allow FORMAT to proceed, checking the existing format of the disk (unless the /U parameter with DOS 5 or 6 is also present), and proceeding with the format.
201
202All this will take place with no delay and no waiting for user input. It will also end without pausing. It will not ask for a volume label or whether to format another diskette.
203
204WARNING! This procedure will also work on hard drives! Be very cautious if you plan to use this feature!
205
206===========================================================================
207 FORMAT /BACKUP
208 --------------
209
210This works exactly like /AUTOTEST, but it does ask for a volume label.
211
212===========================================================================
213 FORMAT /SELECT
214 --------------
215
216This is like the DOS MIRROR command... For safety-fanatics only.
217
218===========================================================================
219 FORMAT /SELECT /U
220 -----------------
221
222Just makes a disk unreadable. Guess it could be handy?
223
224===========================================================================
225 FORMAT /H
226 ---------
227
228In DOS 3.30 (not tested with other versions), FORMAT /H will cause the format to begin immediately after pressing Y in response to "Format another", rather than displaying "Place disk to be formatted in drive x: and press Enter" on a second and subsequent disks.
229
230In DOS 5.0, FORMAT reports "invalid switch".
231
232===========================================================================
233 IF EXIST <dirname>\NUL <command> and IF EXIST EMMXXXX0 <command>
234 ----------------------------------------------------------------
235
236This is a handy quirk of DOS. Installable drivers are seen as files in all directories. You can use the if exist test to either test for the existence of a directory, with "if exist <dirname>\nul", which fails if the directory does not exist because the nul device is not found; or to test whether any driver is loaded, such as the DOS 5 or 6 EMM386 memory manager.
237
238Caveats: For testing NUL, you need to know the name of the directory or the driver whose existence you are testing, and this is MS-DOS specific -- it doesn't work on network drives, and may not work under DR-DOS.
239
240Where did you learn the "EMMXXXX0" name from? Instead of typing MEM /C, type MEM /D for the "debug" listing.
241
242The only trouble is EXISTS returns true for COM3/4 and LPT2/3 even if the hardware does not exist.
243
244===========================================================================
245 Using ATTRIB to hide directories
246 --------------------------------
247
248The DOS 5.0 and 6.0 ATTRIB command can do the same thing for directories as it can for files: ATTRIB +H <dirname> will hide the named directory.
249
250===========================================================================
251 SWITCHES=/W
252 -----------
253
254Enables you to have the Windows 3.0 WINA20.386 file anywhere on your boot drive. Without this you have to have it in the root directory.
255
256This should not be used with Windows 3.1, since it appears to waste around 120K of UMBs.
257
258===========================================================================
259 FOR %%V IN (/SOMETHING)
260 -----------------------
261
262How can a batch file (without 4DOS) determine from which drive it has been started?
263
264 Example: C:\>a:test.bat
265
266Now my batch should be able to find out that it is located on drive A: (not the path, only the drive!).
267
268In a batch file, the variable %0 contains the name of the batch file as it was typed at the command line. If you run the batch file as A:TEST.BAT, %0 will be "A:TEST.BAT". If you have the directory on your path, and simply type TEST, then %0 will be "TEST". The drive, path, and extension will only appear in %0 if you enter them in the command used to call the batch file (either typed at the command line, or called from another batch file). So, you must specify the drive as part of the batch filename for this to work.
269
270To extract the drive only from %0, use the undocumented FOR %%V in /SOMETHING command:
271
272 set drive=
273 for %%v in (/%0) do call test2 %%v
274 echo Calling drive is %drive%
275
276...where TEST2.BAT is:
277
278 if not '%drive%'=='' set drive=%1:
279
280FOR %%V IN (/SOMETHING) DO WHATEVER will do WHATEVER twice -- the first time with %%V set to the first character in SOMETHING ("S"), the second time with all the remaining characters in SOMETHING ("OMETHING"). If SOMETHING is only a single character, WHATEVER will only be called once, with that character in %%V. If the single character is a wildcard (? or *) that wild card will not be expanded to a set of filenames. (The main purpose of this feature is apparently to allow inclusion of the literal characters "?" and "*" without them being expanded.)
281
282This works in DOS 3.30 and later.
283
284===========================================================================
285 DIR,
286 ----
287
288Using a comma immediately after DIR shows ALL files, including the HIDDEN ones.
289
290This appears only to work with DOS 5.0 and 6.0. With 3.30, it doesn't display either IO.SYS, MSDOS.SYS (both with S, H and R attribs) or a test file with A and H attribs.
291
292With DOS 5.0, it displayed a test file with H and A, but would not display IO.SYS or MSDOS.SYS with S, H and R. This isn't surprising actually, since S alone (without H) will prevent inclusion of a file in a normal DIR.
293
294Not tested with DOS 4.x. Not supported by JP Software's 4DOS.
295
296===========================================================================
297 COPY. A:
298 --------
299
300The use of a period IMMEDIATELY after some DOS statements will work just like *.*
301
302 Examples: DEL. (erase all files in current directory)
303 COPY. A: (copy all files in current directory to A:)
304
305There may be more statements with which it works.
306
307This is actually a documented although obscure feature, though the ability to use the period with COPY is not documented. What is documented is the fact that "." and ".." can be used to represent the current and parent directories respectively, and these will work with many applications which can handle directory names as arguments. In this case the "." could also be viewed as a replacement for "*.*"
308
309===========================================================================
310 DOS?=HIGH
311 ---------
312
313DOS?=HIGH in CONFIG.SYS with DOS 6.0 will prompt you whether to load the DOS kernel high (into the HMA) or not.
314
315===========================================================================
316 INSTALLHIGH
317 -----------
318
319In DOS 6.0, there is an undocumented CONFIG.SYS command called INSTALLHIGH= which works just like INSTALL= but loads the TSR high (into upper memory).
320
321The only drawback to this is that MemMaker will not touch INSTALLHIGH lines during the optimizing process. It just takes it as it is currently. But then again, INSTALL= is ignored too. All in all, INSTALL and INSTALLHIGH really are commands to set up manually by the user, and are not really recommended for normal use. Load TSRs at the beginning of AUTOEXEC.BAT (and using LOADHIGH if desired).
322
323 Example:
324
325 DOS=HIGH,UMB
326 DEVICE=C:\DOS\HIMEM.SYS
327 DEVICE=C:\DOS\EMM386.EXE NOEMS
328 INSTALLHIGH=C:\DOS\SHARE.EXE
329
330===========================================================================
331 Using : for batch file comments
332 -------------------------------
333
334DOS uses a leading : to indicate a label in a batch file. If the next character following the : is a space or other non-alphanumeric character, then DOS will decide it's an invalid label and skip to the next line, performing no further action. Faster batch file processing is achieved using this method for comments instead of REM commands.
335
336===========================================================================
337 REM in lines with pipes or redirection
338 --------------------------------------
339
340For example: REM echo y | del *.*
341
342Problems are encountered when trying to REM out an "echo y | del *.*" line in a batch file. The problem appears to only occur if there is a pipe or redirection in the REMed out line, which shows that DOS first reads the entire line and processes pipes and redirections first, and then goes back to find out what to do with them in the line. It's actually doing what it thinks you've told it: Piping the output of REM to DEL. Since REM has no output, DEL hangs, waiting for the answer to its question.
343
344===========================================================================
345 Delimiter character
346 -------------------
347
348Prior to DOS 5.0, there was an undocumented DOS function that would allow you to set the DOS option delimiter character to something else, like a dash (-). Once you did this, you could use either \ or / in PATH specifications.
349
350DOS 5.0 removed the function to set the option delimiter, but retained the function to query what it currently is.
351
352(Unfortunately, no further details were provided in this file, so not sure if the delimiter character can still be changed somehow.)