Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 用于隐藏/取消隐藏的Bat文件_Batch File_Batch Processing - Fatal编程技术网

Batch file 用于隐藏/取消隐藏的Bat文件

Batch file 用于隐藏/取消隐藏的Bat文件,batch-file,batch-processing,Batch File,Batch Processing,我制作了一个用于隐藏和取消隐藏文件夹的bat文件。但是我想用它启用/禁用继承。但隐藏文件后,我无法访问bat文件。我想帮助修改我的bat文件。这是我的代码 @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%'=='h

我制作了一个用于隐藏和取消隐藏文件夹的bat文件。但是我想用它启用/禁用继承。但隐藏文件后,我无法访问bat文件。我想帮助修改我的bat文件。这是我的代码

@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
在CMD.exe中尝试此操作

attrib -h file.bat
如果file.bat是您的可执行文件,那么它只是隐藏的,因此您可以通过此方法取消隐藏它

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


-普林格斯

上述代码的格式已被破坏。请编辑您的问题并替换整个代码部分,以便我们可以看到实际的批处理文件。您可以重新排列代码,以便先禁用继承吗?@ArunaTelshan要格式化代码,您可以在每行前面放置四个空格,如中所述。我想禁用不带bat文件的继承。@AndrewMorton谢谢。