Can I copy files to a Network Place from a script or the command line?

If you are referring to a windows box, just use xcopy. It is pretty standard to have xcopy available.

xcopy src \\dest-machine\shared-library-name\dest
xcopy \\src-machine\shared-library-name\dest src

Powershell uses the abstraction of Providers to provide a common interface into datastores. These seem to stick with the common noun "Item", so you can get a complete list with man *item*. If you know another way to copy and otherwise work with data from a store, you might as well use it, but using the cmdlets provides a better "learn-once, use-often" approach. In your case you could:

Copy-Item test.txt -Destination \\dest-machine\share

Copy-item also supports the -Credential parameter if you need it.


Using a batch file, you can both log on to the resource and copy the file:

The Batch File would contain the following:

net use \\{dest-machine}\{destfolder} {password} /user:{username}
copy {file} \\{dest-machine}\{destfolder}

e.g.

net use \\Development\myfolder mypassword /user:Administrator
copy newfile.c \\development\myfolder