2014-10-18 191 views
0

我做了一个蝙蝠文件隐藏和取消隐藏文件夹。但我想启用/禁用它的继承。但隐藏文件后,我不能访问蝙蝠file.i想帮助修改我的蝙蝠file.Here是我的代码。蝙蝠文件隐藏/取消隐藏

@ECHO off  
cls  
:start  
echo hide. all files in this folder 
echo unhide. all files in this folder 
set /p choice=Type the what do you want to do? 

if '%choice%'=='hide' goto hide 
if '%choice%'=='unhide' goto unhide 
if not '%choice%'=='hide' if not '%choice%'=='unhide' goto :error 

:hide 
attrib /d /s +s +h 
attrib /d /s -s -h unhide.bat 
icacls "%CD%" /T /inheritance:r 
goto :qqq 

:unhide 
attrib /d /s -s -h 
icacls "%CD%" /T /inheritance:e 
goto :aaa :qqq echo "File hide successful" goto end 

:aaa 
echo "File unhide successful" 
goto end  

:error 
echo "please enter correct command" 
goto:start   
:end 
pause 
+0

上面显示的代码的格式被打破。请编辑您的问题并替换整个代码部分,以便我们可以看到实际的批处理文件。 – foxidrive 2014-10-18 11:16:15

+0

您可以重新排列代码,以便先禁用继承吗? – RGuggisberg 2014-10-18 14:21:18

+0

@ArunaTelshan为了格式化代码,您可以在每行前面放置四个空格,如[我如何使用Markdown或HTML格式化我的帖子](http://stackoverflow.com/help/formatting)中所述 – 2014-10-18 16:12:35

回答

0

试试这个CMD.exe。

attrib -h file.bat 

如果file.bat是可执行文件,它只是隐藏起来,这样你就可以通过这个取消隐藏它。

只需将file.bat替换为需要取消隐藏的批处理文件即可。

-Pringles

相关问题