How do you copy using multi-select from Windows.Forms.OpenDialog in PowerShell using folder.copyHere() method?

时间:2018-05-09 02:45:26

标签: powershell user-interface multi-select robocopy

Nubie question ... but you've got to start somewhere. In my powershell console, I call Windows.Forms.OpenDialog to open a GUI file picker and browse to a location on my system and multi-select files that I want to copy. I stash that list in a variable. Next, I use browseForFolder to choose my destination folder path and stash that in a variable

I run folder.copyHere() to copy a file using the Windows default file xfer GUI. One file at a time works. I want to present my multi-selected filename list to folder.copyhere and have it process the list ... Instead, I'm stuck in my ignorance using foreach($file in $list and sending that to folder.copyhere one at a time. It's unpretty.

I tried turning my list of full-path file names into an array, and feeding folder.copyhere() the $vararray - but it wouldn't copy even the first file. One at a time yes, but that's not what I want. If I send my list to robocopy, it processes each item in order, like a champ. But I have GUI users and they want the GUI. Ideas on how to get folder.copyhere() to accept an array of names to process?

0 个答案:

没有答案