標籤:
@echo off&setlocal enableextensions enabledelayedexpansion
title 解決檔案夾隱藏屬性無法修改的問題 批處理
if "%~1"=="" (echo 你沒有拖入任何磁碟或檔案或檔案夾!
echo ------
echo 請把 要處理的磁碟或檔案或檔案夾 拖到 該批次檔表徵圖上
echo 而不是 雙擊啟動 批處理!&pause&goto :eof)
call:choose "設定隱藏檔案屬性,請選擇:" 不改變 去掉 設定
(set h=)&(if !c! equ 2 set h=-)&(if !c! equ 3 set h=+)
call:choose "設定系統檔案屬性,請選擇:" 不改變 去掉 設定
(set s=)&(if !c! equ 2 set s=-)&(if !c! equ 3 set s=+)
call:choose "設定應用範圍,請選擇:" 檔案或檔案夾自身屬性及第一級目錄內容屬性 檔案夾第一級目錄內容屬性
for %%i in (%*) do (if !c! equ 1 call:attrib "%%~i"
for /f "delims=" %%j in (‘dir /a /b "%%~i"‘) do call:attrib "%%~i\%%~j")
pause&goto :eof
:choose
(set c=)&(set n=)&for %%i in (%*) do echo !n! %%~i&set /a n+=1
(set /p c=)&(set /a c=c)&if !c! geq 0 if !c! leq !n! echo.&goto :eof
goto choose
:attrib
setlocal&(set a=)&(set a=%~a1)&if "!a!"=="" goto :eof
if not defined h if "!a:~3,1!"=="h" (set h=+) else (set h=-)
if not defined s if "!a:~4,1!"=="s" (set s=+) else (set s=-)
echo 正在處理: %~1&attrib !h!h !s!s "%~1"&goto :eof
echo 修改成功!
電腦中毒 隨身碟所以檔案被隱藏且不可設為可見