Hello Noah!

Your problem is that you are trying to copy the OpenFileDialog that you presumably created earlier in your code. If you want to copy the file you selected in your file dialog, you will want to select that property of the System.Windows.Forms.OpenFileDialog class, which should be done like so:

Copy-Item $openFileDialog1.FileName -recurse $SelectFolder

In the future when you’re working with the .NET Framework, I recommend reading the MS docs about how to use their framework. It is quite well documented, with examples (mostly in C#, but the important part isn’t the syntax, it’s how they’re using the framework objects). I have linked the page for the particular class you seem to be having trouble with.

Hopefully you found this helpful! If you feel I answered your question, don’t forget to mark it as so!

Also, in the future I’d recommend reading through this to get the best help you can when you ask a question on here! I was only able to figure out your problem after reading your previous comment to something someone else asked you. We don’t know how to fix code unless we know what’s going wrong!

1 Spice up