Microsoft KB Archive/67941

= Removing the Hidden File Attribute =

Article ID: 67941

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft MS-DOS 3.1
 * Microsoft MS-DOS 3.2 Standard Edition
 * Microsoft MS-DOS 3.21 Standard Edition
 * Microsoft MS-DOS 3.3 Standard Edition
 * Microsoft MS-DOS 3.3a
 * Microsoft MS-DOS 4.0 Standard Edition
 * Microsoft MS-DOS 4.01 Standard Edition
 * Microsoft MS-DOS 5.0 Standard Edition
 * Microsoft MS-DOS 5.0a
 * Microsoft MS-DOS 6.0 Standard Edition
 * Microsoft MS-DOS 6.2 Standard Edition
 * Microsoft MS-DOS 6.21 Standard Edition
 * Microsoft MS-DOS 6.22 Standard Edition

-



This article was previously published under Q67941



SUMMARY
This article explains how to use DEBUG to remove the hidden attribute from files on your system.



MORE INFORMATION
The method described below uses DEBUG to create a small program that removes the hidden attribute from a file. This method should be used only as a last resort.   At the MS-DOS prompt, type the following commands: DEBUG A 100 mov dx,116 mov ax,4300 int 21 and cx,fffd mov dx,116 mov ax,4301 int 21 int 20  E 116 'filename' 0  <--- replace &quot;filename&quot; with the path G                            and filename of the target file. Example: e 116 'C:\DATA\TEST.DAT' 0 When you type the command &quot;G,&quot; DEBUG executes the section of code in memory. If you have typed everything correctly, the message &quot;Program terminated normally&quot; is displayed.  Type Q to quit DEBUG, then verify that the file is no longer hidden.

Code Explanation
The following is a detailed description of the preceding code: mov dx,116    ; load the offset to filename into dx mov ax,4300    ; load get/set file attributes function number into ax int 21         ; call DOS interrupt 21H to read attribute information and cx,fffd   ; strip off only hidden attribute bit mov dx,116    ; load the offset to filename into dx mov ax,4301    ; load get/set file attributes function number into ax int 21         ; call DOS interrupt 21H to write attribute information int 20        ; terminate program The program begins by calling Int 21H function 43H to get the current file attribute. The attribute byte is returned in register CX, which is then ANDed with hex FFFD to reset bit 1. The program calls the get/set file attribute function again to write the attribute in register CX to the file.

Additional query words: 6.22 3.20 3.21 3.30 3.30a 4.00 4.01 4.01a 5.00 5.00a 6.00 6.20

Keywords: KB67941

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.