0

I must create a script that works with different variables. They are either names ("my name"), either addresses( 123.45.6.789 ).

Is it possible to have a file "variables.txt" in which I've declared all those variables and then use them in my .bat script ? Both the file and the script will be located within the same directory. Or else, how could I read them ? (I mention that I'm really new to batch, as I just started learning it for my task )

Many thanks

1 Answer 1

2

To read the file you can use something like this:

for %%a in ('type vars.txt') do (
for "delims=;" %%m in ("%%a") do (
set %%m=%%n
)
)

Sorry, but i couldn't test this, because i'm not writing from my PC.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.