CMD:如何递归地删除文件和目录的“隐藏”属性。

时间:2022-11-22 02:09:06

I can't find a command or simple batch of commands to recursively remove the "Hidden"-Attribute from files and directories. All commands like "attrib" and "for" seem to skip hidden files. E.g.:

我找不到命令或简单的命令来递归地删除文件和目录中的“隐藏”属性。所有的命令,如“attrib”和“for”似乎都跳过了隐藏的文件。例如:

attrib -H /S /D /L mydir

doesn't do anything at all, because it skips all hidden stuff. Does someone know how to do this with standard Windows tools?

什么也不做,因为它会跳过所有隐藏的东西。有人知道如何使用标准的Windows工具吗?

7 个解决方案

#1


7  

Move the -h and specify that mydir is a directory

移动-h并指定mydir是一个目录。

attrib /S /D /L -H mydir\*.*

#2


26  

You can't remove hidden without also removing system.

你不能移除隐藏而不移除系统。

You want:

你想要的:

cd mydir
attrib -H -S /D /S

That will remove the hidden and system attributes from all the files/folders inside of your current directory.

这将从当前目录的所有文件/文件夹中删除隐藏和系统属性。

#3


7  

if you wanna remove attributes for all files in all folders on whole flash drive do this:

如果你想删除所有文件夹中所有文件夹的属性,你可以这样做:

attrib -r -s -h /S /D

attrib -r -s -h /S /D。

this command will remove attrubutes for all files folders and subfolders:

此命令将删除所有文件夹和子文件夹的attrubutes:

-read only -system file -is hidden -Processes matching files and all subfolders. -Processes folders as well

-只读-系统文件-隐藏-进程匹配文件和所有子文件夹。过程文件夹也

#4


1  

To make a batch file for its current directory and sub directories:

为当前目录和子目录创建批处理文件:

cd %~dp0
attrib -h -r -s /s /d /l *.*

#5


0  

just type

只要输入

attrib -h -r -s /s /d j:*.*

where j is the drive letter... unlocks all the locked stuff in j drive

j是驱动器号…在j驱动器中解锁所有锁定的东西。

if u want to make it specific..then go to a specific location using cmd and then type

如果你想把它具体化。然后使用cmd,然后输入一个特定的位置。

attrib -h -r -s /s /d "foldername"

it can also be used to lock drives or folders just alter "-" with "+"

它还可以用来锁定驱动器或文件夹,只需修改“-”和“+”

attrib +h +r +s /s /d "foldername"

#6


0  

For example folder named new under E: drive

例如,名为new under E: drive的文件夹。

type the command:

输入命令:

e:\cd new

e:\new\attrib *.* -s -h /s /d

and all the files and folders are un-hidden

所有的文件和文件夹都是不隐藏的。

#7


0  

To launch command prompt in administrator mode

以管理员模式启动命令提示。

  1. Type cmd in Search and hold Crtl+Shift to open in administrator mode
  2. 在搜索中键入cmd,并在管理员模式下保持Crtl+Shift。
  3. Type attrib -h -r -s /s /d "location of the drive letter:" \*.*
  4. 驱动器号的位置:\*.*。

#1


7  

Move the -h and specify that mydir is a directory

移动-h并指定mydir是一个目录。

attrib /S /D /L -H mydir\*.*

#2


26  

You can't remove hidden without also removing system.

你不能移除隐藏而不移除系统。

You want:

你想要的:

cd mydir
attrib -H -S /D /S

That will remove the hidden and system attributes from all the files/folders inside of your current directory.

这将从当前目录的所有文件/文件夹中删除隐藏和系统属性。

#3


7  

if you wanna remove attributes for all files in all folders on whole flash drive do this:

如果你想删除所有文件夹中所有文件夹的属性,你可以这样做:

attrib -r -s -h /S /D

attrib -r -s -h /S /D。

this command will remove attrubutes for all files folders and subfolders:

此命令将删除所有文件夹和子文件夹的attrubutes:

-read only -system file -is hidden -Processes matching files and all subfolders. -Processes folders as well

-只读-系统文件-隐藏-进程匹配文件和所有子文件夹。过程文件夹也

#4


1  

To make a batch file for its current directory and sub directories:

为当前目录和子目录创建批处理文件:

cd %~dp0
attrib -h -r -s /s /d /l *.*

#5


0  

just type

只要输入

attrib -h -r -s /s /d j:*.*

where j is the drive letter... unlocks all the locked stuff in j drive

j是驱动器号…在j驱动器中解锁所有锁定的东西。

if u want to make it specific..then go to a specific location using cmd and then type

如果你想把它具体化。然后使用cmd,然后输入一个特定的位置。

attrib -h -r -s /s /d "foldername"

it can also be used to lock drives or folders just alter "-" with "+"

它还可以用来锁定驱动器或文件夹,只需修改“-”和“+”

attrib +h +r +s /s /d "foldername"

#6


0  

For example folder named new under E: drive

例如,名为new under E: drive的文件夹。

type the command:

输入命令:

e:\cd new

e:\new\attrib *.* -s -h /s /d

and all the files and folders are un-hidden

所有的文件和文件夹都是不隐藏的。

#7


0  

To launch command prompt in administrator mode

以管理员模式启动命令提示。

  1. Type cmd in Search and hold Crtl+Shift to open in administrator mode
  2. 在搜索中键入cmd,并在管理员模式下保持Crtl+Shift。
  3. Type attrib -h -r -s /s /d "location of the drive letter:" \*.*
  4. 驱动器号的位置:\*.*。