[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 求助:批量创建指定文件名,文件的快捷方式

本帖最后由 bluescandy 于 2020-4-18 10:55 编辑

多文件根据文件名检索(txt文件里面有文件名),实现文件名目录(txt文件)查找指定目录,并创建文件的快捷方式到另外的指定文件夹,txt里面有就是文件明细
比如
有一个文件夹里有如下6个文件
1.doc
2.doc
3.doc
4.doc
5.doc
名称清单.txt
然后批处理要根据“名称清单.txt*的内容(文档内容为:“1.doc,3.doc,5.doc”),把“1.doc”“3.doc”“5.doc”这3个文件的快捷方式放到我指定的文件夹


请把语言重新组织一下。
你的意思是,根据文档内的文件名在磁盘中找到相应文件,并创建快捷方式到指定文件夹?

TOP

回复 2# wujunkai


    手机没法上传图片不知为什么

TOP

@echo offrem 根据一个txt文本文件里列出的文件或文件夹的名称清单,将多个文件或文件夹从一个文件夹里复制到另一个新的文件夹里set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4title %#% +%$%%$%/%@% %z%cd /d "%~dp0"set "txtfile=名称清单.txt"set "oldfolder=D:\xxx\原文件夹"set "newfolder=D:\xxx\新文件夹"if not exist "%oldfolder%" (echo;"%oldfolder%" no found&goto end)if not exist "%newfolder%" md "%newfolder%"for /f "delims=" %%a in ('type "%txtfile%"') do (set "f="if exist "%oldfolder%\%%a\" (set f=1echo;"%oldfolder%\%%a" --^> "%newfolder%\%%a\"xcopy "%oldfolder%\%%a" "%newfolder%\%%a\" /e /h /y /q) else (if exist "%oldfolder%\%%a" (set f=1echo;"%oldfolder%\%%a" --^> "%newfolder%\"copy /y "%oldfolder%\%%a" "%newfolder%\"))if not defined f (echo;[not found]"%%a")):endecho;%#% +%$%%$%/%@% %z%pauseexit
这个是批量复制文件(原文件),而我想要的是粘贴快捷方式

TOP

本帖最后由 wujunkai 于 2020-4-16 14:12 编辑

回复 4# bluescandy
  1. mklink /D "%newfolder%\%%~na" "%oldfolder%\%%a"
复制代码

TOP

回复 5# wujunkai


    你好。可能我表达有问题。我最终要的是文件的快捷方式,
比如我文档里有
1.doc
2.doc
3.doc
4.doc
5.doc

有5个文件,然后用一个名称清单.txt(比如这里有1.doc,3.doc,5.doc)
然后要把这3个目标文件的快捷方式放到我指定的文件夹

TOP

回复 6# bluescandy


    你说的文档是 库》文档 吗?

TOP

回复 7# wujunkai


    我重新编辑一下帖子,你帮忙看看

TOP

  1. @echo off
  2. set "link_folder=这里填指定文件夹"
  3. for /F %%i in (名称清单.txt) do mklink /D "%link_folder%\%%i" "%%i"
复制代码
回复 8# bluescandy 需要ANSI保存

TOP

回复 9# wujunkai


    试了还是不行,帮我看一下,我按这个教程也弄不出来
baiduboxapp://swan/y1lpwNoOyVpW33XOPd72rzN4aUS43Y3O/pages/blog/article-detail?articleId=78686600&userName=qq_41222081&utm_source=blogxgwz9&_baiduboxapp=%7B%22from%22%3A%221081000810003000%22%2C%22ext%22%3A%7B%22searchid%22%3A%2210550445090768039205%22%2C%22url%22%3A%22https%3A%5C%2F%5C%2Fyebd1h.smartapps.cn%5C%2Fpages%5C%2Fblog%5C%2Farticle-detail%3FarticleId%3D78686600%26userName%3Dqq_41222081%26utm_source%3Dblogxgwz9%22%2C%22token%22%3A%22swanubc%22%2C%22tplname%22%3A%22www_normal%22%2C%22srcid%22%3A1599%2C%22third_ext%22%3A%7B%22sampleFlag%22%3A%22ivk_xcx_dispatch%22%2C%22ivkSource%22%3A%22h5_schema%22%7D%7D%7D&callback=_bdbox_js_1737&searchQueryEnc=XpHEpe1Z2t0oQWckUpfoxBHDyKfNzJNlA64BjDVfL0Vo1btuQltVXcIxWnqCaBjKgKV71OIYwlXlwIXWTaaXSw%3D%3D&searchQueryEnc2=XpHEpe1Z2t0oQWckUpfoxBHDyKfNzJNlA64BjDVfL0Vo1btuQltVXcIxWnqCaBjKH0or15F1az%2Bc1H2447DdvQ%3D%3D&oauthType=search&searchParams=%7B%22failUrl%22%3A%22http%3A%5C%2F%5C%2Fm.blog.csdn.net%5C%2Fqq_41222081%5C%2Farticle%5C%2Fdetails%5C%2F78686600%22%2C%22logParams%22%3A%22pu%3D%24pu%26clk_info%3D%7B%5C%22tplname%5C%22%3A%5C%22www_normal%5C%22%2C%5C%22srcid%5C%22%3A1599%2C%5C%22ivkStatus%5C%22%3A%5C%22new_ivk_success%5C%22%2C%5C%22type%5C%22%3A%5C%22xcx%5C%22%2C%5C%22ivkSource%5C%22%3A%5C%22h5_schema%5C%22%2C%5C%22xcx_path%5C%22%3A%5C%22https%25253A%25252F%25252Fyebd1h.smartapps.cn%25252Fpages%25252Fblog%25252Farticle-detail%25253FarticleId%25253D78686600%252526userName%25253Dqq_41222081%252526utm_source%25253Dblogxgwz9%5C%22%2C%5C%22xcx_id%5C%22%3A%5C%22y1lpwNoOyVpW33XOPd72rzN4aUS43Y3O%5C%22%2C%5C%22xcx_from%5C%22%3A%5C%221081000810003000%5C%22%7D%26baiduid%3D%24baiduid%26tcreq4log%3D1%26lid%3D10550445090768039205%26l%3D1%26t%3Dzbios%26ref%3Dwww_zbios%26from%3D1001703e%26isAtom%3D1%26order%3D1%26w%3D0_10_%5Cu6279%5Cu5904%5Cu7406+%5Cu521b%5Cu5efa%5Cu5feb%5Cu6377%5Cu65b9%5Cu5f0f+%5Cu8001%5Cu4e5d%5Cu5b66%5Cu5802%26tj%3Dwww_normal_1_0_10_l%26cyc%3D1%26src%3Dhttp%25253A%25252F%25252Fm.blog.csdn.net%25252Fqq_41222081%25252Farticle%25252Fdetails%25252F78686600%22%7D&useTpl=1

TOP

返回列表