Hello, I'm beginner and I have one problem, I want to do menu like :
MENU
-------------------------------------
%A%
%B%
%C%
-------------------------------------
%D%
%E%
-------------------------------------
And I want put it into %menu%, but I don't know how to /set that with this spacing... Help
Edit, ok I want put this :
" MENU
-------------------------------------
%A%
%B%
%C%
-------------------------------------
%D%
%E%
------------------------------------- "
into variable %menu%
And when I write :
Echo %menu%
I will have :
MENU
-------------------------------------
%A%
%B%
%C%
-------------------------------------
%D%
%E%
-------------------------------------
Like /set something=I like potatoe
and when I write
Echo %something%
I will have :
I like potatoe
That's all, sorry i can't explain it easie, I hope you will understand...
/set command
Moderator: DosItHelp
/set command
Last edited by Euvarios on 10 Nov 2014 09:59, edited 1 time in total.
Re: /set command
You are going to have to explain with a lot more detail what you are trying to accomplish. Please show some examples as well.
Thanks
Thanks
Re: /set command
Are you are asking how to put an entire menu in a single variable?
That's not the usual way to do it in a batch file.
That's not the usual way to do it in a batch file.
Re: /set command
I'm not sure, but it could also be that you (Euvarios) want(s) to have a dynamic menue without redefining it.
If this is true, this might help you (tested on WinXP home 32 bit):
penpen
If this is true, this might help you (tested on WinXP home 32 bit):
Code: Select all
@echo off
setlocal disableDelayedExpansion enableExtensions
set LF=^
set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
set ^"menu=MENU^^^%LF%%LF%^%LF%%LF%^^%\n%
-------------------------------------^^^%LF%%LF%^%LF%%LF%^^%\n%
!A!^^^%LF%%LF%^%LF%%LF%^^%\n%
!B!^^^%LF%%LF%^%LF%%LF%^^%\n%
!C!^^^%LF%%LF%^%LF%%LF%^^%\n%
-------------------------------------^^^%LF%%LF%^%LF%%LF%^^%\n%
!D!^^^%LF%%LF%^%LF%%LF%^^%\n%
!E!^^^%LF%%LF%^%LF%%LF%^^%\n%
-------------------------------------^"
echo(
echo( Menu definition:
echo(
set "A="
set "B="
set "C="
set "D="
set "E="
echo %menu%
setlocal enableDelayedExpansion
echo(
echo( Menu Variation 1
echo(
set A=Menuitem 1
set B=Menuitem 2
set C=Menuitem 3
set D=Menuitem 4
set E=Menuitem 5
echo %menu%
echo(
echo( Menu Variation 2
echo(
set A=1. Menuitem
set B=2. Menuitem
set C=3. Menuitem
set D=4. Menuitem
set E=5. Menuitem
echo %menu%
endlocal
endlocal
goto :eof
penpen