简体   繁体   中英

What is the simplest way to copy a file from local to a shared folder by a PowerShell script?

(I am asking this question as a developer without having not very deep system admin knowledge.)

I need to copy one file that I generate -which is a csv- to a Shared Folder in the network.

What is the simplest, safest and warrantied way to achieve this within my PS Script ?

(Is it the same way to copy a file from one directory to another one -or there are things to be aware of in order to accomplish this without any problems?)

Is it the same way to copy a file from one directory to another one

Yes.

Copy-Item

(or its copy alias).

or there are things to be aware of in order to accomplish this without any problems?

Not particularly. Cross the network does introduce additional error cases (eg. network connectivity lost) but these are handled as failures of the Copy-Item (eg. destination could have insufficient space whether local or remote).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM