首页 > 解决方案 > 试图创建一个批处理文件来移动和替换 desktop.ini 但它说找不到文件

问题描述

我的代码是:

cd "%UserProfile%\Desktop\Post-Install\Icon Config Files\"

move /y "Games\desktop.ini" "%UserProfile%\Games"
move /y "Music\desktop.ini" "%UserProfile%\Music"
move /y "Personal Docs\desktop.ini" "%UserProfile%\Personal Docs"
move /y "Pictures\desktop.ini" "%UserProfile%\Pictures"
move /y "Software\desktop.ini" "%UserProfile%\Software"
move /y "User\desktop.ini" "%UserProfile%"
move /y "Videos\desktop.ini" "%UserProfile%\Videos"

taskkill /f /im explorer.exe

start explorer.exe

但是,每次我运行它时,它都会告诉我“系统找不到指定的文件”。我能做些什么来完成这项工作?

标签: windowsbatch-filecmd

解决方案


desktop.ini文件是隐藏的,这就是move命令找不到它们的原因。因此,在每次移动之前使用 删除隐藏的(和系统,它必须是两者)属性attrib -s -h "Games\desktop.ini",并且在每次移动之后使用 恢复这些属性attrib +s +h "%UserProfile%\Games\desktop.ini"


推荐阅读