[HELP] How to read a variable with a for

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
.:Xx4NG3LxX:.
Posts: 3
Joined: 21 Feb 2020 09:37

[HELP] How to read a variable with a for

#1 Post by .:Xx4NG3LxX:. » 21 Feb 2020 10:31

Hello guys, I'm new in the forum, I'm 14 years old. I'm Venezuelan. I don't speak English very well but...

Ok, I would like know How to read a variable with a for.

Example:

Code: Select all

Set "abc=abcdefghijklmnopqrstuvwxyz"
For %%a in (::I don't know) do (::I don't know)
::More code
Thanks!

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: [HELP] How to read a variable with a for

#2 Post by Squashman » 21 Feb 2020 10:36

You really have not defined the scope of what you are trying to accomplish.

In the simplest form, to access the contents of a variable you reference the variable with percent symbols.

Code: Select all

Set "abc=abcdefghijklmnopqrstuvwxyz"
echo %abc%
If you want to read that variable with the FOR command, again just reference the variable with percent symbols.

Code: Select all

Set "abc=abcdefghijklmnopqrstuvwxyz"
For %%a in ("%abc%") do echo %%~a

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: [HELP] How to read a variable with a for

#3 Post by Squashman » 21 Feb 2020 10:56

I saw your reply before you decided to delete it. I am not going to provide an answer to your question now since you may have decided on changing the scope of your question.

.:Xx4NG3LxX:.
Posts: 3
Joined: 21 Feb 2020 09:37

Re: [HELP] How to read a variable with a for

#4 Post by .:Xx4NG3LxX:. » 21 Feb 2020 11:08

Could you translate that please? Thanks!

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: [HELP] How to read a variable with a for

#5 Post by Squashman » 21 Feb 2020 11:15

.:Xx4NG3LxX:. wrote:
21 Feb 2020 11:08
Could you translate that please? Thanks!
I don't speak your language but feel free to use Google Translate yourself.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: [HELP] How to read a variable with a for

#6 Post by Squashman » 21 Feb 2020 11:21

If you are having a difficult time getting help in English, may I suggest you post your question on a technical forum that speaks your language.

Stack Overflow en español

.:Xx4NG3LxX:.
Posts: 3
Joined: 21 Feb 2020 09:37

Re: [HELP] How to read a variable with a for

#7 Post by .:Xx4NG3LxX:. » 21 Feb 2020 11:35

Good idea. But I'll follow visiting the forum. Thank you so much!

There are too many forums. I usually visite elhacker.net, is very good. But it's in Spanish.

Post Reply