Can I copy files to a Network Place from a script

2019-02-06 14:25发布

Is it possible, in Windows XP, to copy files to a Network Place from the command line, a batch file or, even better, a PowerShell script?

What sent me down this road of research was trying to publish files to a WSS 3.0 document library from a user's machine. I can't map a drive to the library in question because the WSS site is only available to authenticate via NTLM on a port other than 80 or 443. I suppose I could alternately use the WSS web services to push the files out, but I'm really curious about the answer to this question now.

9条回答
你好瞎i
2楼-- · 2019-02-06 15:04

you could use the 'net' commands to authenticate and then copy the files.

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

I'm not really sure exactly how to handle authentication if it's needed.

查看更多
Root(大扎)
3楼-- · 2019-02-06 15:08

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.

查看更多
Animai°情兽
4楼-- · 2019-02-06 15:10

Yes you can. I suggest using a tool like robocopy.

查看更多
登录 后发表回答