我想让一台服务器读其他服务器的日志文件.
我在XP上访问另一XP中的共享目录,不要求帐号密码,单纯用"\\服务器名\目录名\文件名"就可以.但如果我要访问带权限的2003或者2000呢?该把帐号密码加在哪里?

解决方案 »

  1.   

    可以使用net use 连接对方机器,前提是你必须知道用户名密码或者用FTP,HTTP访问
      

  2.   

    那请问net use的程序要怎么写?
    我是建立一个Process然后执行cmd 在标准输入中写net use....
    可是没有效果
      

  3.   

    http://community.csdn.net/Expert/TopicView3.asp?id=5137183
      

  4.   

    十分感谢 蟑螂,程序调通了,我增加了一句
    while (p.HasExited == false)
    {
       p.WaitForExit(1000);
    }
    才可以.
    不知道这句话的作用是什么?
      

  5.   

    又有问题,我照葫芦画瓢写了个关闭所有连接的功能,却实现不了?
                Process p1 = new Process();
                p1.StartInfo.FileName = "cmd.exe";
                p1.StartInfo.UseShellExecute = false;
                p1.StartInfo.RedirectStandardInput = true;
                p1.StartInfo.RedirectStandardOutput = true;
                p1.StartInfo.RedirectStandardError = true;
                p1.StartInfo.CreateNoWindow = false;
                p1.Start();
                string command=@"net use * /del";
                p1.StandardInput.WriteLine(command);
                p1.StandardInput.WriteLine("exit");
                while (p1.HasExited == false)
                {
                    p1.WaitForExit(1000);
                }
                p1.Dispose(); p1.Close();  
      

  6.   

    OK解决了,怪我非要写 net use * /del 确定盘符就没有删除提示了