受欢迎的博客标签

Windows操作系统--一键清理垃圾脚本

Published

C盘空间不足,AppData目录占用空间很大

 

从操作系统级维度

批处理删除无用文件

ps: 以管理员身份运行

@echo off

echo 正在清除系统垃圾文件,请稍等......

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\*.*"

echo 清除系统LJ完成!

echo. & pause

 

@echo off

color 0a

title windows10系统垃圾清理---

echo 清理垃圾文件,速度由电脑文件大小而定。在没看到结尾信息时

echo 请勿关闭本窗口。

echo 正在清除系统垃圾文件,请稍后。。。。。。

echo 删除补丁备份目录

RD %windir%\$hf_mig$ /Q /S

echo 把补丁卸载文件夹的名字保存成2950800.txt

dir %windir%\$NtUninstall* /a:d /b 》%windir%\2950800.txt

echo 从2950800.txt中读取文件夹列表并且删除文件夹

for /f %%i in (%windir%\2950800.txt) do rd %windir%\%%i /s /q

echo 删除2950800.txt

del %windir%\2950800.txt /f /q

echo 删除补丁安装记录内容(下面的del /f /s /q %systemdrive%\*.log已经包含删除此类文件)

del %windir%\KB*.log /f /q

echo 删除系统盘目录下临时文件

del /f /s /q %systemdrive%\*.tmp

echo 删除系统盘目录下临时文件

del /f /s /q %systemdrive%\*._mp

echo 删除系统盘目录下日志文件

del /f /s /q %systemdrive%\*.log

echo 删除系统盘目录下GID文件(属于临时文件,具体作用不详)

del /f /s /q %systemdrive%\*.gid

echo 删除系统目录下scandisk(磁盘扫描)留下的无用文件

del /f /s /q %systemdrive%\*.chk

echo 删除系统目录下old文件

del /f /s /q %systemdrive%\*.old

echo 删除回收站的无用文件

del /f /s /q %systemdrive%\recycled\*.*

echo 删除系统目录下备份文件

del /f /s /q %windir%\*.bak

echo 删除应用程序临时文件

del /f /s /q %windir%\prefetch\*.*

echo 删除系统维护等操作产生的临时文件

rd /s /q %windir%\temp & md %windir%\temp

echo 删除当前用户的COOKIE(IE)

del /f /q %userprofile%\cookies\*.*

echo 删除internet临时文件

del /f /s /q “%userprofile%\local settings\temporary internet files\*.*”

echo 删除当前用户日常操作临时文件

del /f /s /q “%userprofile%\local settings\temp\*.*”

echo 删除访问记录(开始菜单中的文档里面的东西)

del /f /s /q “%userprofile%\recent\*.*”

echo

开始-windows系统-cmd(鼠标右键)-系统管理员

 

output

删除文件 - C:\Users\Administrator2\Local Settings\Temp\x3dlkyz4.vpn\av5by1x4.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\xobcgkrf.1jd\uvoehjp4.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\xoyfvuuy.wjq\ucworc2a.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\yqsclyis.nxb\bpjtr5hd.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\yzbywucc.51j\twfkugny.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\zi0dltl2.wdn\0jcddwh4.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\zsf3mt4t.5f3\1mu022zg.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\zzir1mwd.0hy\b2sdkuxb.json
删除文件 - C:\Users\Administrator2\Local Settings\Temp\{6AEFDB88-9A95-4389-9A6A-5C4D2BD07930}\.be\igfx_win10_100.8935.exe

echo 清除系统LJ完成!

Move pagefile.sys to another SSD

Move pagefile.sys to another SSD if you have one (HDD can be done too but may cause lower performance).

Search Start menu for control panel

Enter System and Security, then System (may open Settings app)

Enter advanced system settings

Click settings under performance then enter advanced tab

Click change under virtual memory and remove the checkbox for automatic for all drives at the top

Make no page file for C drive and system managed for the other drive.

 

 

 

从软件维度进行删除

释放QQ占用的C盘空间

https://www.cnblogs.com/jeakon/archive/2013/02/19/2917584.html

释放PC版微信占用的C盘空间

https://www.iaspnetcore.com/Blog/BlogPost/63f14dcf75514502b1137497/how-to-change-the-file-storage-directory-location-of-pc-version-wechat

2.4G

Android studio-解决占C盘空间的方法

https://www.cnblogs.com/chunshu/p/6402902.html

Chrome浏览器清理工具

====Chrome浏览器清理工具,有安装Chrome浏览器的可以使用如下操作

参见:https://www.google.com/chrome/cleanup-tool

Chrome 可帮助您找出 Windows 计算机中的可疑程序或垃圾程序。
如果 Chrome 检测到有垃圾程序,请点击移除。
Chrome 会移除该软件,将部分设置设为默认值,并关闭扩展程序。
您还可以手动检查计算机中是否存在恶意软件。

1. 打开 Chrome。
2. 依次点击右上角的“更多”图标 更多 接着 设置。
3. 点击底部的高级。
4. 在“重置并清理”下方,点击清理计算机。
5. 点击查找。
如果系统要求您移除垃圾软件,请点击移除。

Visual Studio-释放占用的C盘空间

vs delete  some directory

C:\Program Files\dotnet\sdk
C:\Program Files\dotnet\packs 这个占用空间大 4G,vs下载得nuget 包
C:\Program Files\dotnet\shared

C:\Program Files\dotnet\sdk-manifests\6.0.300
 

3G  size

C:\ProgramData\Package Cache
 

C:\windows\softwareDistribution\Download
路径文件夹是系统更新补丁下载默认路径,里边的文件夹也定期清理一次

 

C:\windows\softwareDistribution\Download
附:其中三个文件夹的作用,里面的文件可以随心所欲地删除。
C:/Users/用户名/AppData/Local/Temp里面是临时文件。
C:/Users/用户名/AppData/Local/Microsoft/Windows/Temporary Internet Files里面是IE缓存文件(默认是隐藏的)。
C:/Users/用户名/AppData/Local/Microsoft/Windows/History里面是浏览器历史记录(默认是隐藏的)。

C:/Users/用户名/AppData/Local/IconCache.db就是大名鼎鼎的图标缓存文件,删除IconCache.db有时可以解决很多问题
http-cache: C:\Users\user1\AppData\Local\NuGet\v3-cache
global-packages: C:\Users\user1\.nuget\packages\
temp: C:\Users\user1\AppData\Local\Temp\NuGetScratch
plugins-cache: C:\Users\user1\AppData\Local\NuGet\plugins-cache

 

Windows 10 下 C 盘清理的四个最好办法

https://mp.weixin.qq.com/s?__biz=Mzg5NjUzMTY3Mg==&mid=2247484660&idx=1&sn=c37e2b4f41bf4967d7b57c494d4ac373&source=41#wechat_redirect

https://cloud.tencent.com/developer/article/1748848

 

 

 

C盘空间不足,AppData目录占用空间很大

Deleting or moving AppData may cause corruption and kill all or any of your applications. Not recommended.

C盘空间不足,AppData目录占用空间很大,AndroidSudio , Chrome , JetBrains ,Postman占用空间很大,如何清理?

AppData目录的文件结构

我们首先来看C盘的文件结构(我的电脑是Dell,用户文件夹下的主用户名文件夹就是Dell):

C: 
|--- ...
|--- Windows # 系统文件,不要动
|--- 用户
     |--- Dell
     |    |--- AppData # 隐藏文件夹
     |    |    |--- Local
     |    |    |    |--- Google
     |    |    |    |    |--- Chrome
     |    |    |    |    |--- ...
     |    |    |    |--- ...
     |    |    |--- ...
     |    |--- .PyCharmCE2018.3
     |    |--- ...
   	 |--- 公用

C:\Users\你的用户名\AppData会占据很大空间。在appdata 下面有三个文件夹,分别是Local;  local low; Roaming

接下来对这三个文件夹分别进行说明:

           Local:本地保存文件:本地保存文件。其中的AppData\Local\Temp\可以删除

          LocalLow:是用来存放共享数据,该文件夹不可删除

          Roaming:保存应用程序运行后的数据信息,如果删除应用程序配置数据会丢失。所以不可删除。

 

这些应用程序放在C盘中的文件,有几点作用:

保存程序使用的历史记录(如浏览记录、游戏存档、微信聊天记录、视频缓存等);
保存该程序在本电脑上的配置信息,比如VS Code的配置文件C:\Users\Dell\AppData\Roaming\Code\User;
登录文件的信息,密码等;
插件等;
版本迭代信息。
上述这些偷偷安放的数据文件,都具有一下特点:

不可随意或直接删除,否则应用程序可能直接崩坏,并且无法补救;
要么在C:\Users\Dell\目录下,要么在C:\Users\Dell\AppData\的目录及其子目录下;
除了历史记录以外,数据量其实都不大(保存一万账号的个密码,可能也才占用几MB)。
因此,我们的核心工作就是,清空不重要的历史记录!

 

C:\Users\Administrator\AppData\Local\Temp

3G  size

C:\Users\Administrator\AppData\Local\Microsoft

 

1.windows下有一个叫FolderSize的插件,可以显示文件夹/目录大小

2.C盘AppData目录占用过多空间,修改idea配置文件没用

AppData\local\Google\AndroidStudio4.1
AppData\local\Google\Chrome
AppData\local\JetBrains
AppData\local\Postman

将AppData目录搬家

3.处理办法:
①剪切AppData\local\下的目录,比如JetBrains这个目录到其他盘
②打开cmd ,在AppData\local\目录下执行以下命令

mklink /J "JetBrains" "E:\user\username\AppData\local\JetBrains"

mklink /J "Postman" "E:\user\username\AppData\local\Postman"

mklink /J "Google" "E:\user\username\AppData\local\Google"

https://blog.csdn.net/qq_26632895/article/details/116706022

https://linustechtips.com/topic/1424155-windows-11-can-u-clean-out-appdata-folder-safely/

 

step 1: create a 2nd user, make it administrator

If you cannot move/delete the original copy, create a 2nd user, make it administrator, login with it, and retry the option. This should ensure that no files are in use.

step 2:move AppData\local\  to new location

 

Step 3:replace the original with a symbolic link to the new location

Once you have moved it, you must replace the original with a symbolic link to the new location. This will make windows think the data is still located on your C drive, while it actually is on your D drive.

Do note, this does work with AppData, but not with Program Files nor with the Windows folder, as it will break things like Windows Update.

To create the Directory Junction (Symbolic Link) do the following:

Open a cmd window with administrative privileges.
Navigate to

c:\Users\username\appdata


execute the following command: 

mklink /d local d:\appdata\local


replace d:\appdata\local with the actual path of where you moved the appdata to.

 

 

Windows 10 查看文件夹大小(GUI)

点击“开始”菜单进入“设置”窗口,选择“系统→存储”,去查看每个分区及各类文件所占的空间

 

Useful links

clean appdata

 


https://linustechtips.com/topic/1424155-windows-11-can-u-clean-out-appdata-folder-safely/

https://theitbros.com/appdata-folder