0
我一直在寻找一段时间,看看我是否可以创建一个进入子目录但停止,执行命令,然后离开目录而不进入任何目录的脚本的子子目录。下面是我到目前为止有:循环遍历每个子目录而不会更深 - 批处理脚本
FOR /R "%cd%" %%G in (.) DO (
cd %%G
echo %%G
cd ..
)
但问题是,它只是不断通过每一个子目录会不停止,所以它看起来是这样的:
now in C:\Users\JacobGunther12\Desktop\Batch GMA Converter\(gdcw)_usp_.45_silenced_300572504\models\.
now in C:\Users\JacobGunther12\Desktop\Batch GMA Converter\(gdcw)_usp_.45_silenced_300572504\models\weapons\.
now in C:\Users\JacobGunther12\Desktop\Batch GMA Converter\(gdcw)_usp_.45_silenced_300572504\sound\.
now in C:\Users\JacobGunther12\Desktop\Batch GMA Converter\(gdcw)_usp_.45_silenced_300572504\sound\impacts\.
now in C:\Users\JacobGunther12\Desktop\Batch GMA Converter\(gdcw)_usp_.45_silenced_300572504\sound\weapons\.
now in C:\Users\JacobGunther12\Desktop\Batch GMA Converter\(gdcw)_usp_.45_silenced_300572504\sound\weapons\usp45\.
,而不是仅仅进入了文件夹“批量GMA转换器”中的第一个子目录。有没有办法做到这一点?
您需要向我们展示了什么'%CD%'是让您发布的输出;我认为你可以用'for/D'循环替换'for/R'循环... – aschipfl
如果你使用常识,你可以告诉%cd%是C:\ Users \ JacobGunther12 \ Desktop \ Batch GMA Converter \ @aschipfl –
什么是常识,@JacobGunther? ...不,认真地说,我更喜欢问OP,因为你永远不知道他们是如何理解术语“子目录”(sub to root?)的;没有在问题中陈述的每一条信息都可能被错误地假设,从而导致错误的结论...... – aschipfl