windows - 重命名文件时出现错误 "The syntax of the command is incorrect"

标签 windows batch-file command-line

我在 SQL 2005 进程的这一步遇到了这个错误:

rename "G:\AuthorsList\AuthorsList_New.mdb""G:\AuthorsList\AuthorsListCopy.mdb"

我正在尝试重命名文件。我也试过这个并得到同样的错误:

rename "G:\AuthorsList\AuthorsList_New.mdb" "G:\AuthorsList\AuthorsListCopy.mdb"

如何解决此错误?

最佳答案

查看 rename 的文档命令:

Syntax
rename [Drive:][Path]filename1 filename2

Parameters
[Drive:][Path]filename1: Specifies the location and name of the file or set of files you want to rename. FileName1 can include wildcard characters (* and ?).
filename2: Specifies the new name for the file. You can use wildcard characters to specify new names for multiple files.

第二个参数不能是路径,它应该只包含新文件名:

rename "G:\AuthorsList\AuthorsList_New.mdb" AuthorsListCopy.mdb

关于windows - 重命名文件时出现错误 "The syntax of the command is incorrect",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20105735/

相关文章:

windows - 批处理文件脚本到 zip 文件

batch-file - 使用 wget 或 curl 从 Jenkins 下载工件

java - 在 Windows 中设置默认堆大小

windows - 删除旧版本的 Ruby(在 Windows 上)

windows - 如何使用 Powershell 编辑快捷方式中的 Target 属性以在文件路径后包含一个字符?

c - 理解linux命令的源代码在哪里?

python - 如何在 python 中的第二个提示符中导航

windows - 为什么有些网络 API 能够接受远程连接,而有些则不能?

command-line - 如何阻止 Windows 批处理文件提前退出?

c# - 在服务器上执行 powershell .ps1 文件并查看结果 C# asp.net