中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-13 00:39
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Resolved Issue] Batch script to remove the hidden attribute of hidden folders (注:原内容中“[已解决的问题]”翻译为“[Resolved Issue]”,“去掉隐藏文件夹隐藏属性的批处理”翻译为“Batch script to remove the hidden attribute of hidden folders”,整体按照要求准确翻译,保留了原有的格式和内容。)
Printable Version  3,630 / 11
Floor1 Auto Posted 2008-05-15 17:33
初级用户 Posts 27 Credits 64
Seek batch scripts to display hidden folders

Recently, the USB flash drive has been frequently infected by viruses, causing all the folders inside to be hidden.

How to use a batch script to remove the hidden attributes of these folders..

By the way, give some explanations. I have learned a little about batch processing, but I'm very novice..

[ Last edited by Auto on 2008-5-17 at 09:46 AM ]
Floor2 pooronce Posted 2008-05-15 19:21
中级用户 Posts 250 Credits 484
dir /a
attrib -s -h -r
Floor3 Auto Posted 2008-05-15 19:27
初级用户 Posts 27 Credits 64
Originally posted by pooronce at 2008-5-15 07:21 PM:
dir /a
attrib -s -h -r

I know this is relatively troublesome. I want a batch processing with high automation level that can display all hidden folders in the current directory as soon as it runs
Floor4 HAT Posted 2008-05-15 19:35
版主 Posts 5,017 Credits 9,023
It's not that the folder is hidden, but that the registry has been modified.

Save the following code as ShowAll.reg, and double-click to import the registry to view hidden files.

Floor5 Auto Posted 2008-05-16 15:10
初级用户 Posts 27 Credits 64
I want to remove the hidden attributes of these folders..
Continue to ask for help
Still thank you to the above
Floor6 HAT Posted 2008-05-16 15:16
版主 Posts 5,017 Credits 9,023
Originally posted by Auto at 2008-5-16 03:10 PM:
I want to remove the hidden attributes of these folders..
Continue to ask for help
Still thank you upstairs

Floor7 knoppix7 Posted 2008-05-16 22:53
银牌会员 Posts 634 Credits 1,287 From cmd.exe
dir /AHD /s /b
Then refer to LS's code and add FOR
Floor8 Auto Posted 2008-05-17 09:27
初级用户 Posts 27 Credits 64
@echo off
set SrcDir=D:\Tools\test
for /f "tokens=1* delims=" %%a in ('dir /AHD /s /b "%SrcDir%"') do (
attrib -h -s -a -r "%SrcDir%\%%a"
)
pause

I ran the above and got the following prompt
The system cannot find the path - D:\Tools\test\D:\Tools\test
The system cannot find the path - D:\Tools\test\D:\Tools\test
The system cannot find the path - D:\Tools\test\D:\Tools\test
The system cannot find the path - D:\Tools\test\D:\Tools\test
Press any key to continue . . .

After摸索, I just found out..
The /s parameter in the dir sentence should be removed..


Also, I need someone to improve it
That is, put this batch file in that folder and run it to remove the hidden attribute of the hidden folders in the current folder
That is, how to replace the value of the variable SrcDir with the current path..

[ Last edited by Auto on 2008-5-17 at 09:29 AM ]
Floor9 Auto Posted 2008-05-17 09:44
初级用户 Posts 27 Credits 64
Through the guidance of the above - mentioned各位 and my own exploration, the batch processing I need should be like this:

:: Remove the hidden attribute of sub - folders in the current folder
@echo off
for /f "tokens=1* delims=" %%a in ('dir /adh /b') do (
attrib -h -s -a -r ".\%%a"
)


Thank you, above - mentioned各位 brothers.

[ Last edited by Auto on 2008 - 5 - 17 at 09:46 AM ]
Floor10 cisheng97 Posted 2009-12-16 00:26
初级用户 Posts 24 Credits 31
Floor11 jarry0932 Posted 2009-12-16 01:44
初级用户 Posts 122 Credits 128
First, use the one from floor 4, modify the registry to show all hidden files and system files, then directly drag the hidden file onto this batch processing:
attrib -s -h %1
Simple and clear
Floor12 cisheng97 Posted 2009-12-16 21:19
初级用户 Posts 24 Credits 31
Good post. Very helpful to myself
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023