I need some help dim'ing my variables I have a test line of code for my ultimate project. I am new to the BATCH coding language. But not to BASIC and some C++ so I am not a complete noob.
Here is the line of code that I need help with,
@echo off
set var=%csname%
echo select option
Echo.
Echo 1). Keith
Echo 2). Martin
Echo.
set /p %csname%=Choose a name;
Echo %csname%
Pause
I want to get var to display in my batch file but when I run it nothing happens. I know I might be making it to complicated but I don't know how to go about it. Please help and thanks.
Please help meh, with variables
Moderator: DosItHelp
Re: Please help meh, with variables
'
Code: Select all
@echo off &SetLocal EnableDelayedExpansion
:§name.select ()
::(
echo.select option
echo.
echo.1). Keith
echo.2). Martin
echo.
set /p "$name=Choose a name:"
set "$names=Keith, Martin"
set /a $count = 0
for %%! in (
%$names%
) do (
set /a $count += 1
if !$count! equ !$name! (
set "$name=%%~!"
)
)
echo.$name=!$name!_
if !$name! equ +!$name! (
goto :§name.select "()"
)
::)
pause
exit /b