本文介绍了如何将txt文件复制到远程计算机。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码,它是将文件复制到任何远程计算机的标准代码。



但是它不断弹出这个错误:找不到网络路径。



请帮帮我!



我的尝试:



Below is my code which is standard code to copy a file to any remote computer.

But it keeps popping up this error : The network path was not found.

Please help me out !

What I have tried:

private void CopyFilesToSharedLocation1()
    {
        IntPtr admin_token = default(IntPtr);
        WindowsIdentity wid_admin = null;
        WindowsImpersonationContext wic = null;

        if (LogonUser("WIN-ABC/Administrator", "WIN-ABC", "ABCDEF", 9, 0, ref admin_token) != 0)
            {
                wid_admin = new WindowsIdentity(admin_token);
                wic = wid_admin.Impersonate();
                System.IO.File.Copy("E:/Temp/abc.txt", "\\\\WIN-ABC\\TestFolder\\abc.txt", true);


            }
            else
            {

            }

    }

推荐答案


这篇关于如何将txt文件复制到远程计算机。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 18:52