- @echo off
- color 1f
- title 更改文件的“系统、隐藏”属性
- set /p file=请输入文件或目录的绝对路径:
- attrib %file%>>1.tmp
- for /f "tokens=1 delims=" %%i in (1.tmp) do set tmp="%%i"&del 1.tmp
- if "%tmp:~4,2%"==" H" (attrib %file% -h&attrib %file% +h +s&echo:已经为该文件添加系统属性!)
- if "%tmp:~4,2%"=="S " (attrib %file% -s&attrib %file% +h +s&echo:已经为该文件添加隐藏属性!)
- if "%tmp:~4,2%"=="SH" (attrib %file% -h -s&echo:已经去掉了该文件的隐藏和系统属性!)
- if "%tmp:~4,2%"==" " (attrib %file% +h +s&echo:已经给文件加上隐藏和系统属性!)
- pause>nul
复制代码 多谢。。现在改正~刚学批处理确实有太多地方要注意。 |