禁止更新文件访问时间,降低磁盘写入:
fsutil behavior set disablelastaccess 1
磁盘只读属性设置与清除:
diskpart
DISKPART> list disk
DISKPART> select disk #
DISKPART> attr disk set readonly
DISKPART> attr disk clear readonly
关闭和开启 Windows Defender(需要管理员权限):
REM Dos batch
sc stop WinDefend
sc start WinDefend
REM Windows PowerShell
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableRealtimeMonitoring $false
镜像目录树:backup.bat
SET XD=$RECYCLE.BIN "System Volume Information"
SET SRC=%~1
SET DST=%~2
IF "%SRC%" EQU "" SET /P SRC=来源目录:
IF "%DST%" EQU "" SET /P DST=目标目录:
SET DT=%date:~0,10%_%time:~0,8%
SET DT=%DT:/=%
SET DT=%DT::=%
SET DT=%DT: =0%
SET LOG=%DT%_%SRC:~0,1%_%DST:~0,1%.log
ROBOCOPY %SRC% %DST% /XD %XD% /MIR /R:0 /COPY:DAT /DCOPY:DAT /LOG:%LOG% /NP /TEE
计算目录下所有文件的MD5并保存到文件:mkmd5.bat
SET DIR=%~1
IF "%DIR%" EQU "" SET /P DIR=输入目录:
SET DIR=%DIR:\=/%
SET DT=%date:~0,10%
SET DT=%DT:/=%
FOR %%N IN ("%DIR%") DO SET DirName=%%~nN
SET MD5Path=%DIR%/../%DirName%_%DT%.md5
SET PATH=%MinGW%
find %DIR% -type f -print0 | xargs -0 md5sum -b | sed "s|%DIR%|.|g" > %MD5Path%