batch programming help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
vvomble
Posts: 9
Joined: 08 Jul 2013 07:07

batch programming help

#1 Post by vvomble » 08 Jul 2013 07:26

wondered if you could help

hopefully you can tell what I'm doing with this:

:hexvalues
set /p hex1=02ac08
set /p hex2=953fcd
set /p hex3=fb0ca6
set /p hex4=69fa87
set /p hex5=34bae9

I want is so that when I put %hex1% etc after an echo is will show as 02ac08

I don't think this is correct but this is the first time i've had a go at batch programming.

If you could explain in lamen's terms that would be better still

Sponge Belly
Posts: 216
Joined: 01 Oct 2012 13:32
Location: Ireland
Contact:

Re: batch programming help

#2 Post by Sponge Belly » 08 Jul 2013 09:13

Hello VVomble! :-)

Um… what’s wrong with… ?

Code: Select all

set "hex1=02ac08"
echo(%hex1%


Or am I missing something? And why are you using set /p? What are you trying to achieve? Please explain your task in more detail.

- SB

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: batch programming help

#3 Post by penpen » 08 Jul 2013 09:20

You are using the set command with the /p option:
set /p hex1=02ac08

With this command line, you have instructed the command processor to show
the black text within the shell and then to prompt the user for input. The user
then may type in some characters and finalize the input by pressing the return
key, or the user may abort in various ways. The text you have typed in is then
stored into the variable hex1; if you haven't typed in text, the variable remains
unchanged.

What you want to do is just assign 02ac08 to hex1.
For this you should use the parameterless set command:

Code: Select all

set hex1=02ac08

penpen

Edited: Sry the syntax highlighting took longer than thought.
Last edited by penpen on 08 Jul 2013 09:25, edited 1 time in total.

vvomble
Posts: 9
Joined: 08 Jul 2013 07:07

Re: batch programming help

#4 Post by vvomble » 08 Jul 2013 09:22

That worked perfectly, I'm just playing with a basic script i found on the net and set /p was used after inputs I wasn't sure if that was the correct way to set it (although it wasn't working but it's now sorted thanks a million

Post Reply