C盘瘦身命令行方式

保存下面为.bat文件,然后双击执行,就可以为C盘瘦身

net session >nul 2>&1
if not "%errorLevel%" == "0" (
  echo Oops: This tools must run with administrator permissions!
  echo it will popup the UAC dialog, please click [Yes] to continue.
  echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  echo UAC.ShellExecute "%~s0", "%*", "", "runas", 1 >> "%temp%\getadmin.vbs"
  "%temp%\getadmin.vbs"
  exit /b 2
)

@echo off
Dism /online /cleanup-image /restorehealth

chkdsk
sfc /scannow
 
echo cleanup gabarge files, please wait ...

rmdir   %temp% /S /Q
del   %temp% /S /Q

del /f /s /q  %systemdrive%\*.tmp
 
del /f /s /q  %systemdrive%\*._mp
 
del /f /s /q  %systemdrive%\*.log
 
del /f /s /q  %systemdrive%\*.gid
 
del /f /s /q  %systemdrive%\*.chk
 
del /f /s /q  %systemdrive%\*.old
 
del /f /s /q  %systemdrive%\recycled\*.*
 
del /f /s /q  %windir%\*.bak
 
del /f /s /q  %windir%\prefetch\*.*
 
rd /s /q %windir%\temp & md  %windir%\temp
 
del /f /q  %userprofile%\cookies\*.*
 
del /f /q  %userprofile%\recent\*.*
 
del /f /s /q  "%userprofile%\Local Settings\Temporary Internet Files\*.*"
 
del /f /s /q  "%userprofile%\Local Settings\Temp\*.*"
 
del /f /s /q  "%userprofile%\recent\*.*"
 
del /f /s /q  "C:\Windows\SoftwareDistribution\Download\*.*"
del /f /s /q  "C:\Program Files\NVIDIA Corporation\Installer2\*.*"
 
echo done!
 
echo. & pause

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值