批处理脚本为文件名添加前缀
我试图在批处理脚本中重命名文件,如下所示:
rename %FOLDER%\* 1-*
但是当我运行脚本时,它会用前缀“1-”覆盖原始名称的前两个字符,而不是将其添加到文件名的开头。我该如何解决这个问题?
I am trying to rename files in a batch script like this:
rename %FOLDER%\* 1-*
but when I run the script It overwrites the first two characters of the original names with the prefix "1-" instead of adding it to the beginning of the file names. How can I work around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重命名只会重命名文件,您需要在前缀之后将文件名作为变量调用。下面是最终的工作结果。
Rename will just rename the file, you would need to call the file name as a variable after the prefix. The below is what ended up working.
尝试以此为起点
try this as a starting point