目录文件夹列表中的变量 [英] List a directory folder to a variable

查看:136
本文介绍了目录文件夹列表中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这是更好地问这分开,而不是从我在我的previous发表评论期待一个答案。

I felt it was better to ask this separately rather than expect an answer from my comment on my previous post.

我已经为目录号码设置变量%中jobn%这是独特的是有办法,我可以搜索未知的元素添加到另一个变量,我知道通过命令行,我可以运行目录D09854 * ,我会得到一个报告的全名,可以这样莫名其妙地收集并加入到一个名为变量?

I already have variables set for the directory number %jobn% which is unique is there a way I can search for the unknown element to add to another variable, I know via the command line I can run Dir D09854* and I will get a single report with the full name, can this be collected somehow and add to a named variable?

S:\SWDA\HBOS>dir d09854*
 Volume in drive S is Images
 Volume Serial Number is FE8F-38FE

 Directory of S:\SWDA\HBOS

18/02/2013  10:29    <DIR>          D09854_Parent Test

我要的元素后,_给一个变量%DirDesc%这样我就可以创建加结合%%%中jobn%DirDesc 来获得完整的路径D09854_Parent测试

I want to add the elements after "_" to a variable %DirDesc% so I can create the full path by combining %jobn%%DirDesc% to get "D09854_Parent Test"

推荐答案

DIR d09854 * / B 将在同一行收回全部文件夹名称,没有额外多余的内容如果这有什么用处?你在写这个小工具?
它必须是良好的老式DOS,或者可以使用较新的命令扩展?

dir d09854* /b will recover the full folder name in one line, without the extra cruft, if that's any use? What are you writing this widget in? Does it have to be Good Old Fashioned DOS, or can the newer Command extensions be used?

在有限的老的DOS,我不能想办法来获取到一组变量,而不输送至一个临时的批处理文件,具有第一回显的一个设置变量= 进去,并在管道使用>>追加到它...然后调用临时批处理文件来执行的命令!

With limited old DOS, I can't think of a way to get that into a SET Variable without piping it to a temporary batch file, having first ECHO'd a set variable= into it, and using >> in the pipe to append to it... and then CALL the temporary batch file to execute the command!

这篇关于目录文件夹列表中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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