[英]Windows batch script for copying files to folder
I was able to do this in Linux, but Windows batch script is a lot different, hope someone can help me.我能够在 Linux 中执行此操作,但是 Windows 批处理脚本有很大不同,希望有人可以帮助我。 I have a folder with a couple 100 files.
我有一个包含 100 个文件的文件夹。 I want a batch script that creates a folder for each of these files with the same name, but without the extension (eg: sheet1.xls will create a folder named sheet1).
我想要一个批处理脚本,为这些文件中的每一个创建一个具有相同名称但没有扩展名的文件夹(例如:sheet1.xls 将创建一个名为 sheet1 的文件夹)。
After that each file should to moved to its corresponding folder (eg: sheet1.xls -> create folder sheet1 -> move the xls file to sheet1 folder).之后,每个文件都应该移动到其对应的文件夹(例如:sheet1.xls -> 创建文件夹 sheet1 -> 将 xls 文件移动到 sheet1 文件夹)。
Can anyone help me out with this?谁能帮我解决这个问题?
for %%a in (C:\folder\*.*) do (
md "%%~pna"
move "%%a" "%%~pna"
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.