Debug: w (write)

Writes a file or specific sectors to disk. Used without parameters, w starts from CS:100.

Syntax

w [address]

w [address] [Drive] [firstsector] [number]

Parameters

address : Specifies the beginning memory address of the file, or portion of the file, you want to write to a disk file.

Drive : Specifies the drive that contains the destination disk. This value is numeric: 0 = A, 1 = B, 2 = C, and so on.

firstsector : Specifies the hexadecimal number of the first sector to which you want to write.

number : Specifies the number of sectors to which you want to write.

?: Displays a list of debug subcommands.

Remarks

Windows XP does not use this command. It is accepted only for compatibility with MS-DOS files. 

To write the contents of the number of bytes specified in the BX:CX registers to a disk file, use the following syntax:

w [address]

To bypass the file system and directly write to specific sectors, use the following syntax:

w [address] [Drive] [firstsector] [number]

Specifying valid address entries

Address is a two-part designation, containing either an alphabetic segment register or a four-digit segment address with an offset value. You can omit the segment register or segment address. CS is the default segment for the following debug subcommands: a, g, l, t, u, and w. DS is the default segment for all other subcommands. All numeric values are in hexadecimal format. You must include a colon between the segment name and the offset value. The following are valid addresses:

CS:0100

04BA:0100

Specifying the name of the disk file You must specify the name of the disk file either when you start Debug.exe or in the most recent n (name) subcommand. Both of these methods properly format a file name for a file control block at address CS:5C.

Resetting BX:CX before using w without parameters

If you use the g (go), t (trace), p (proceed), or r (register) subcommands, you must reset the BX:CX registers before using the w subcommand without parameters.

Writing a modified file to a disk

If you modify the file but do not change the name, length, or starting address, Debug.exe can write the file to the original disk location correctly.

Writing .exe or .hex files

You cannot write an .exe or .hex file with this command.

 Warning

Writing to specific sectors is extremely risky because it bypasses the Windows XP file handler. The disk's file structure can be damaged if you type the wrong values.

For information about specifying a file by using the n (name) subcommand, see Related Topics.

For information about loading the contents of a file or file sectors into memory by using the l (load) subcommand, see Related Topics.

Examples

To write the contents of memory, beginning at the address CS:100, to the disk in drive B and start collecting data from the disk's logical sector number 37h and continue for 2Bh sectors, type:

wcs:100 1 37 2b

When the write operation is complete, Debug.exe displays the debug prompt again.

Formatting legend

FormatMeaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Debug subcommands

Debug

Command-line reference A-Z



© 2016 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy & Cookies