Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
Exchange Server
Working with two arrays
Last Post 12 Mar 2010 02:12 AM by
RvdNieuwendijk
. 1 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
MaryK
Basic Member
Posts:104
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
RvdNieuwendijk
New Member
Posts:3
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.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
Exchange Server
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2