header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Working with two arrays
Last Post 12 Mar 2010 02:12 AM by RvdNieuwendijk. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
MaryKUser is Offline
Basic Member
Basic Member
Posts:104
Avatar

--
22 Feb 2010 08:17 AM
    Hello,

    I am creating a Form that will use two list boxes. The two list boxes will give me two arrays $x and $y once loaded as below where x(i) is a filename  and y(i) is a folder just to ilustrate but they could be mailboxes that I need to move or anything else:
    $x
    x1
    x2
    x3
    x4

    $y
    y1
    y2
    y3
    y4

    How can I match arrays item x(i) to array item y(i) without using a scriptblock? As an example, I need to copy x(i) into y(i)

    copy-item x1 y1
    copy-item x2 y2
    ...etc
    RvdNieuwendijkUser is Offline
    New Member
    New Member
    Posts:3
    Avatar

    --
    12 Mar 2010 02:12 AM
    I don't know why you don't want to use a scriptblock, but I would do something like:

    0..3 | ForEach-Object {Copy-Item $x[$_] $y[$_] }

    Robert
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer