When I was organizing files recently, I encountered some problems with hidden files and unable to open folders. I just wrote a blog to organize it.
System environment
- windows10
Article Directory
Hidden files
1. Hiding based on hidden attributes
The easiest way to hide files under windows is to directly hide the files in the explorer.
However, if our explorer opens the display of hidden files, this method will be invalid.
Of course, the other way around, if we do not open Can it be hidden by displaying it? of course
It can be done by forcibly locking the settings that are not displayed in the registry through the bat script. There are a lot of sharing at night, which is omitted here (in fact, it is not displayed all the time, which is quite inconvenient)
2. Attribute assignment based on attrib command
Under cmd, we can use attrib to manipulate various attributes of the file. The help for using attrib is as follows:
assign file hidden attributes
attrib +s +h filename
Unhide attributes
attrib -s -h filename
View file attributes
attrib filename
dir /a
Of course, the above method is applied to cmd, powershell can use the following command
# 查看文件以及属性
get-childitem --force
❯ get-childitem -force
目录: D:\test\111
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2020/3/4 17:09 33642 1.txt
Powershell get-childitem
also makes aliases, and the effect is the same:
- gci
- ls
- to you
Of course, you can modify the file permissions under powershell, but it is more attrib
troublesome than under cmd. What is needed is the idea of variable assignment (after all, object-oriented language), the code is as follows:
❯ $filename = get-item .\1.txt
❯ $filename.mode
-a----
❯ $filename.Attributes
Archive
❯ $filename.Attributes = "archive","hidden","system"
Hide folder
Hide based on special suffix
In fact, it is clsid, the unique identification number of the windows component object
A CLSID is a globally unique identifier that identifies a COM class object. If your server or container allows linking to its embedded objects, you need to register a CLSID for each supported class of objects.
To use, just add the suffix to
view the file is actually very simple, the same as above
To remove the suffix, you need to use the rename command in cmd, poweshell is omitted
rename "d:/test/111.{450D8FBA-AD25-11D0-98A8-0800361B1103}" "111"
Of course, the empty folder name can also be achieved by using rename
rename "d:/test/111.{450D8FBA-AD25-11D0-98A8-0800361B1103}" " .{450D8FBA-AD25-11D0-98A8-0800361B1103}"
Common clsid are as follows:
name | CLSID |
---|---|
my document | {450D8FBA-AD25-11D0-98A8-0800361B1103} |
my computer | {20D04FE0-3AEA-1069-A2D8-08002B30309D} |
Network Neighborhood | {208D2C60-3AEA-1069-A2D7-08002B30309D} |
Recycle bin | {645FF040-5081-101B-9F08-00AA002F954E} |
InternetExplorer | {871C5380-42A0-1069-A2EA-08002B30309D} |
control panel | {21EC2020-3AEA-1069-A2DD-08002B30309D} |
Dial-up network/network connection | {992CFFA0-F557-101A-88EC-00DD010CCC48} |
mission plan | {D6277990-4C6A-11CF-8D87-00AA0060F5BF} |
Printer (and fax): | {2227A280-3AEA-1069-A2DE-08002B30309D} |
History folder | {7BD29E00-76C1-11CF-9DD0-00A0C9034933} |
ActiveX cache folder | {88C6C381-2E85-11D0-94DE-444553540000} |
briefcase | {85BBD920-42A0-1069-A2E4-08002B30309D} |
.. Deletion of suffix files and folders
There may also be... this kind of directory hiding method, in fact, it is not directory hiding, it can be understood as soft link pointing
If you encounter... this kind of suffix, or a file with a space suffix, can not be deleted, enter the subsystem bash under windows, switch to the directory, and then rm
delete
Windows cannot delete these files or folders because the file name includes invalid names in the Win32 namespace. When you use the windows command to delete, it will resolve to point to a non-existent folder or file, so it cannot be found. file