windows - 试图创建一个批处理文件来移动和替换 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
但是,每次我运行它时,它都会告诉我“系统找不到指定的文件”。我能做些什么来完成这项工作?
解决方案
desktop.ini文件是隐藏的,这就是move
命令找不到它们的原因。因此,在每次移动之前使用 删除隐藏的(和系统,它必须是两者)属性attrib -s -h "Games\desktop.ini"
,并且在每次移动之后使用 恢复这些属性attrib +s +h "%UserProfile%\Games\desktop.ini"
推荐阅读
- c++ - 使用二进制搜索打印在结构向量中找到的大量值
- symfony - Sulu 2.0:如何将自定义 css 和 js 添加到管理视图
- sql - SQL Server STRING_AGG 和 group by 用于一个表中的列,但不用于另一个表中的列
- javascript - 从 Django 服务器将 Keras 模型导入 TensorFlow.js
- ruby-on-rails - CSV上传显示故障Rails 6
- arrays - 返回二维数组并将其作为参数传递给另一个函数
- javascript - 如何使用 web3 js 在 uniswap 上交换令牌
- java - 使用 Apache Commons Imaging 缩放图像
- javascript - 访问 Vue 模板中的所有 Laravel 路由
- f# - 在 F# 中,集合函数可以直接用作它们支持的类型的方法吗?