如何通过批处理将文件夹名称 + 我自己的预定义值保存在 > .txt 文件中命令指令

How to save Folder Names + My own Predefined Value in a > .txt file via Batch | CMD

我正在尝试将一堆 .7z 文件上传到我的服务器,我的客户可以在其中自动下载 links。上传 .7z 文件后,我需要在 .txt 编辑器中 copy/paste 最后一个文件扩展名,并使用我网站的自定义 URL 对其进行解析。是这样的:


{.7z 文件}

001187238.7z

009181905.7z


{Server/Link文件夹}

https:///website/s1/2291817181/918291918/

https:///website/s1/8817530194/114532001/


{下载链接/完成过程}

https:///website/s1/2291817181/918291918/009181905.7z

https:///website/s1/8817530194/114532001/001187238.7z


有什么办法可以运行

dir /B %userprofile%\Desktop\folder > --foldernames--.txt

并可能将它与固定的 string/link:

结合起来
https://website/s1/2291817181/918291918/

所以,最后我得到一个 link + 文件夹名称组合,并保存在 .txt 文件中?

谢谢!

我很难从你的描述中理解你想要什么(特别是,如何确定,哪个文件应该连接到哪个文件夹),但要回答问题本身:

@echo off
(for /f "delims=" %%a in ('dir /B %userprofile%\Desktop\folder\*.7z') do (
  echo https://website/s1/2291817181/918291918/%%a
)) > --foldernames--.txt