【发布时间】:2019-04-29 06:48:38
【问题描述】:
当我重新启动我的笔记本电脑(windows 7 64 位)时,我通常需要输入以下 CMD 命令来恢复我的桌面图标,从黑色方块恢复为普通图标。
cd /d %userprofile%\appdata/local
del iconcache.db /a
exit
(我打开CMD,上面的命令一一输入)
我需要你的帮助来编写一个按上述顺序执行上述命令的批处理文件。
【问题讨论】:
-
您只需复制此问题中的代码部分并将其粘贴到扩展名为 .cmd 或 .bat 的文本文件中。完全不清楚你到底觉得你需要什么帮助。
-
斜线和反斜线?虽然这通常会起作用,但请使用正确的
\作为文件夹分隔符:cd /d %userprofile%\appdata\local。您的代码可以缩短为del /a "%userprofile%\appdata\local\iconcache.db" (as IInspectable said, just put it into a textfile, name it with an extension of.bat` 并将其放入您的自动启动(启动)文件夹中。 -
这是解决此问题的错误方法。参见例如How to Rebuild a Broken Icon Cache in Windows 10。还有预定义的环境变量
LOCALAPPDATA保存当前用户帐户的本地应用程序数据文件夹的路径。所以del "%LOCALAPPDATA%\iconcache.db" /a足以删除这个文件,见Windows Environment Variables。
标签: windows batch-file cmd windows-7 windows-7-x64