我有一个文件夹充满了配置文件,名为config#.json,其中#是一个2位数的基数为15的数字。我需要一些方法来选择其中一个文件,并将其名称放在一个变量中
我一直在想这个问题,但我不是一个非常高级的批处理程序员。例如,如果我从第8行获得最后一个条目或其他东西,可能有一种方法是使用dir命令的结果。我可以摆脱名称中的空间,这可能会更容易:批处理:从目录中选择顶级文件
Volume in drive C is Local Disk
Volume Serial Number is 1A97-93E9
Directory of C:\Users\hazzj\Google Drive\Home\Stuff\Apache-Server\htdocs\launcher_profiles
12/10/2016 05:44 PM <DIR> .
12/10/2016 05:44 PM <DIR> ..
12/10/2016 05:44 PM 707 config 11.json <- this bit here
12/10/2016 05:44 PM 707 config 12.json
12/10/2016 05:44 PM 707 config 13.json
12/10/2016 05:44 PM 707 config 14.json
12/10/2016 05:44 PM 707 config 15.json
12/10/2016 05:44 PM 707 config 16.json
12/10/2016 05:44 PM 707 config 17.json
12/10/2016 05:44 PM 707 config 18.json
12/10/2016 05:44 PM 707 config 19.json
204 File(s) 144,228 bytes
2 Dir(s) 344,802,287,616 bytes free
任何帮助,我将不胜感激。
[批处理脚本从目录获取第一个文件名]的可能副本(http://stackoverflow.com/questions/11882993/batch-script-to-get-first-filename-from-a-directory) –