POWERSHELL-BATCHFILE EXERCISE


Joined
Jan 28, 2023
Messages
5
Reaction score
0
@echo off
setlocal enabledelayedexpansion

rem create list
set a[0]=michael
set a[1]=pique
set a[2]=elias
set a[3]=george
set a[4]=tobias

rem based on the table above and using (for) command to create the following content display:
for /L %%i in (0,1,4) do (
set /a j=4-%i%
echo !a[%%i]! !a[%%j]!)
if %i% LSS 4 (
set /a i+=1
)
pause

Can someone help? I want make it work and show me that
michael tobias
pique george
elias elias
george pique
tobias michael
 
Ad

Advertisements

Joined
Jan 30, 2023
Messages
108
Reaction score
9
@echo off
setlocal enabledelayedexpansion

rem create list
set a[0]=michael
set a[1]=pique
set a[2]=elias
set a[3]=george
set a[4]=tobias

rem based on the table above and using (for) command to create the following content display:
for /L %%i in (0,1,2) do (
set /a j=4-%%i
echo !a[%%i]! !a[!j!]
)
pause

hummm ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top