CMD为无法动弹,由于串屠宰文件 [英] CMD for unable to move files due to string butchering

查看:392
本文介绍了CMD为无法动弹,由于串屠宰文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想格式化我使用的U盘在我的车作为音乐数据库。
然而,我的广播只能在同一时间播放一个文件夹,所以我认为这将是有益的艺术家的所有标题移动到艺术家的文件夹中。

I'm trying to format my USB stick for use in my car as music database. However, my radio can only playback one folder at a time, so I thought it would be helpful to move all titles of an artist to the artist's folder.

由于这是喜欢音乐,这将是用手很多工作的32GB。

Since this are like 32GB of music that would be a lot of work by hand.

我已经想出了下面的脚本来完成这项工作(G:\\作为USB驱动器)

I've come up with the following script to do the job (G:\ being the USB drive)

FOR /F %%T IN ('dir G:\ /B /A:D') DO (
    FOR /R %%D IN (G:\%%T\*.*) DO MOVE "%%d" "G:\%%T"
)

到目前为止这工作,但'目录G:\\ / B / A:D 命令结束了这种方式屠宰的文件夹名称:FOLDER NAME - >文件夹。因此,它基本上只是拿起出于某种原因,第一个字。

So far this works, but the 'dir G:\ /B /A:D' command ends up butchering the folder names in this fashion: "FOLDER NAME" -> "FOLDER". So it essentially just picks up the first word for some reason.

请帮忙。

推荐答案

metavariable是批量的几个地方是区分大小写之一。在 %%ð MST匹配 %%ð - 反之亦然

The FOR metavariable is one of the few places in batch that is case-sensitive. The %%D mst match the %%d - or vice-versa.

(但你可能做得很好,包括delims =之间的 FOR / F 和metavariable ...),以确保整个字符串被分配给metavariable

(but you'd probably do well to include "delims=" between the FOR/f and the metavariable...) to ensure that the entire string is assigned to the metavariable.

这篇关于CMD为无法动弹,由于串屠宰文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆