尝试创建一个批处理文件来移动和替换desktop.ini,但它说无法找到文件

问题描述 投票:1回答:1

我的代码是:

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

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

windows batch-file cmd
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.