【发布时间】:2015-04-12 09:56:37
【问题描述】:
以下信息包含在一个文本文件中,格式如下。
/var/www/xxx/html/videos/video_folder_1
/var/www/xxx/html/videos/video_folder_2
/var/www/xxx/html/videos/video_folder_3
/var/www/xxx/html/videos/video_folder_4
/var/www/xxx/html/videos/video_folder_5
/var/www/xxx/html/videos/video_folder_6
/var/www/xxx/html/videos/video_folder_7
我在已经定义的批处理文件中还有一个名为%file_name% 的变量。
所以可以说是%file_name% = V001-video_folder_6.mp4
如您所见,还有更多额外信息,V001- 和 .mp4。
我想使用 var %file_name% 来搜索文本文件并返回整行。在这种情况下,它将返回/var/www/xxx/html/videos/video_folder_6,然后将此信息放入一个新的变量中,比如%folder_path%。
我想我会使用findstr,但是我一直在玩,并没有得到最好的结果。
【问题讨论】:
标签: batch-file automation