请问,在C#中能不能操作另一台电脑上的非共享文件夹下的文件

解决方案 »

  1.   

    能够操作其他机器的文件主要是看你当前机器是否具有修改该台机器指定文件的NT权限,开了共享只是默认将修改权限赋予了User而已,同理,将其他文件夹的修改权限设得低点应该也是可以进行操作的。
      

  2.   

    可能通过WINSOCK实现,不过麻烦些也可以这么做,不知可不可以,
    共享时共享名后加上“$”,这些共享时别人无法看见,是隐藏的共享,访问时用共享名后加“$”
      

  3.   

    IPC$共享,不过要知道对方管理 员账号
      

  4.   

    在知道对方管理员帐号和密码的情况下,在C#中能不能操作另一台电脑上的非共享文件夹下的文件
    有源代码吗
    //*****************************************************************************
    應該可以,但是沒試過,你可以做一個網絡磁碟映射,(這個需要知道对方帐号和密码) 如H
    然後直接直接對H路徑操作,和訪問本機是一樣的
      

  5.   

    可以,但是你要有登录的id和password,当然如果你发现了漏洞,呵呵,就不需要了.
      

  6.   

    有登录的id和password,该怎么做呢
    有源码吗?
    谢谢
      

  7.   

    用socket客户端可以,只是要编服务端
      

  8.   

    用WMI对象可以实现。private void CreateProcess(string stringCommandLine)
    {   
    //Set up a handler for the asynchronous callback
    ManagementOperationObserver observer = new ManagementOperationObserver(); 
    completionHandler.MyHandler completionHandlerObj = new completionHandler.MyHandler(); 
    observer.ObjectReady  += new ObjectReadyEventHandler(completionHandlerObj.Done); string stringMachineName = ""; //Connect to the remote computer
    ConnectionOptions co = new ConnectionOptions(); if (radioMachine.Checked == true)
    {
    stringMachineName = "localhost";
    }
    else
    {
    stringMachineName = textIP.Text;
    } if (stringMachineName.Trim().Length == 0)
    {
    MessageBox.Show("Must enter machine IP address or name.");
    return;
    } //get user and password
    if (textUserID.Text.Trim().Length   > 0)
    {
    co.Username = textUserID.Text;
    co.Password = textPassword.Text;
    } //Point to machine
    System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co);      
    //get process path
    ManagementPath path = new ManagementPath( "Win32_Process"); //Get the object on which the method will be invoked
    ManagementClass processClass = new ManagementClass(ms,path,null); //Status
    updateStatus("Create process " + stringCommandLine + ".");

    //Create an array containing all arguments for the method
    object[] methodArgs = {stringCommandLine, null, null, 0}; //Execute the method
    processClass.InvokeMethod (observer, "Create", methodArgs); //wait until invoke method is complete or 5 sec timeout
    int intCount = 0;
    while (!completionHandlerObj.IsComplete) 

    if (intCount > 10)
    {
    MessageBox.Show("Create process timed out.", "Terminate Process Status");
    break;
    }
    //wait 1/2 sec.
    System.Threading.Thread.Sleep(500); 

    //increment counter
    intCount++;
    }  if (intCount != 10)
    {
    //InvokeMethod did not time out
    //check for error
    if (completionHandlerObj.ReturnObject.Properties["returnValue"].Value.ToString() == "0")
    {
    //refresh process list
    this.Refresh();
    }
    else
    {
    MessageBox.Show("Error creating new process.", "Create New Process");
    }
    } //Status
    updateStatus("Ready");
    this.Update();
    }