Windows 批处理 : Set Variables from Text File

标签 windows text batch-file text-files

我目前正在寻找一种通过 txt 文档中的链接在 Windows 批处理文件中设置变量的方法。

例如,如果文本文件显示为:

http://website1.com
http://website2.com
http://website3.com

我希望可以将它们输出到批处理中的变量。示例:

set var1="Line one of text file, ex: http://website1.com"
set var2="Line two of text file, ex :http://website2.com"
set var3="Line three of text file, ex: http://website3.com"

感谢任何帮助,提前致谢!

最佳答案

来啦!玩得开心。

(
set /p var1=
set /p var2=
set /p var3=
)<Filename.txt

让您获得相同的结果!

关于Windows 批处理 : Set Variables from Text File,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5886334/

相关文章:

windows - Powershell ISE 在终止进程时卡住

java - 访问网络摄像头时发出通知的桌面程序

python - 为什么定位 Shadow dom 元素在第 5 个元素处失败?

testing - .bat 脚本可以编写 java 文件并编译它吗?

windows - Vagrant+图书馆员 puppet : unable to load puppet [Windows]

c# - 将(一些)Unicode 非间距标记与相关字母组合以进行统一处理

jquery - 如何将 HTML 文本区域转换为单词 :count key value array with jQuery?

ruby - 如何一次匹配多个正则表达式的行?

arrays - 将函数的第二个参数读入数组

loops - 批处理 for 循环中的 Nslookup - 为什么它不起作用?