Remove Trojan file attributes from RHS and RHSA files using batch processing

Source: Internet
Author: User

P.S. The easiest way to do this is to create a bat file and then drag files and directories that cannot be deleted one at a to this bat file.

Kill.bat
Code

The code is as follows Copy Code
del/f/a/q \?%1
RD/S/q \?%1

Recently, the server was uploaded with some files for RHS and RHSA file properties. There is no way to delete directly. To delete the first thing you need to know what's going on with these file attributes.
Windows system Property Symbol description
The properties of the folder are: None, H,hs,hsa,r,ra,rh,rha.
The properties of the file are: A,RA,RSA,RHSA.
Where: H (hide)-Hidden, S (System)-Systems, R (read only)-read only, A (Archive)-archived.

Specific modifications can be learned from the following knowledge:

To change the properties of a file, you can use the DOS command
For example, create a new O.TXT file under G disk
Enter the DOS interface into the G-Packing directory
Use command attrib +a +s +h o.txt
Then file O.txt has the HSA attribute.
Use the command >attrib-a-s-h o.txt
Then file O.txt eliminates the HSA attribute.
Do not forget to sign the file after the command, otherwise it will operate by default to other files

ATTRIB--------------------------------------------------------------------------------
Displays or modifies the properties of the file.
This command displays, sets, or deletes the read-only (read-only), archive (Archive), System, and Hidden (Hidden) attributes of a file or directory.
Grammar:
ATTRIB [+r|-r] [+a|-a] [+s|-s] [+h|-h][[drive:][path]filename] [/S]
To display all the properties for all files in the current directory, use the command:
ATTRIB

Parameters:
[Drive:] [Path]filename
Specifies the name of the file to be processed and the drive letter, pathname, and path name.


Switch item:
+r set read-only file properties

-R clears read-only property of a file

+a Setting File Archive properties

-A clear File archive properties

+s set file as a system file

-S clears system file properties

+h settings file as a hidden file

-H Clear Hidden file properties

/S operates on files in the current directory and all subdirectories


Related commands:

For more information about copying files and directories with different attributes, see < <XCOPY> commands.


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


attrib─ annotation


Hide attributes and System attribute combinations

If a file has both a hidden attribute and a system attribute, a attrib command can be used to delete both properties. For example, to delete the hidden and system attributes of the RECORD.TXT file, you can typing:

The code is as follows Copy Code

Attrib-s-H record. Txt


Attrib applied to a group of files

Use wildcard characters (? and *) in file parameters to display and change a set of file properties at the same time. If a file has a system or hidden attribute, it must be cleared before any other properties of the file can be changed.


Changing directory Properties

The catalog can be displayed or modified by attributes. attrib for the directory, you must explicitly give the directory name, not the wildcard character. For example, to hide the directory C:secret, you can enter a command:

The code is as follows Copy Code

ATTRIB +h C:secret

The following command works only on files and does not affect the directory

The code is as follows Copy Code

ATTRIB +h C:*.*


View Archive Properties

The archive attribute (a) is used to mark files that have changed since the last backup. These archive attributes are used by the Msbackup, restore, and Xcopy commands. For more information about archive properties, see:
<msbackup>, <RESTORE> and <XCOPY>


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

attrib─ Example


The following command displays the file attributes named NEWS86 on the current drive:

The code is as follows Copy Code

attrib news86

The following command assigns a read-only property to the file REPORT.TXT:

The code is as follows Copy Code

attrib +r report.txt

The following command deletes the read-only property from the file attribute of the file in the directory Publicjones and its subdirectories that exists on disk B:

The code is as follows Copy Code

Attrib-r B:publicjones*.*/S

As a last example, suppose you want to manipulate all the files (except the. bak file) in the default directory for a disk. Because you want to use <XCOPY> to copy files that are marked with an archive attribute, you need to set the archive attribute for the file you want to copy. This can be done with the following two commands, which first sets the file attributes for all files on a drive, and then deletes those bands. The archive attribute of the file for Bak extension:

The code is as follows Copy Code

attrib +a a:*.*

Attrib-a A:*.bak

Next, use the Xcopy command to back up the files in disk A to the B drive disk. The/A switch instructs Xcopy to back up only files with archived attributes:

The code is as follows Copy Code

xcopy A:b:/A

To enable Xcopy to delete the file's archive attribute after each copy of the file, simply change the switch/A to/M, for example:

The code is as follows Copy Code

xcopy A:b:/M

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.