简体   繁体   中英

Get variables from txt file and run them into loop with BATCH

I need to assign variables form txt file.

1.txt

Extinct
Legends

And I want to use them in for loop with this command.

C:\another.bat "%var%"

Which means when I run the bat file It will do C:\\another.bat "Extinct" and after that C:\\another.bat "Legends".

How to do that?

@echo off
set "file_loc=1.txt"
for /f "usebackq delims=" %%L in ("%file_loc%") do (

  call   C:\another.bat "%%~L" 

)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM