Advertisement
Guest User

Untitled

a guest
Feb 27th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1.  public static void SaveACopyfileToServer(string filePath, string savePath)
  2.         {
  3.             var directory = Path.GetDirectoryName(savePath).Trim();
  4.             var username = "hp";
  5.             var password = "7303";
  6.             var filenameToSave = Path.GetFileName(savePath);
  7.  
  8.             if (!directory.EndsWith("\\"))
  9.                 filenameToSave = "\\" + filenameToSave;
  10.  
  11.             var command = "NET USE " + directory + " /delete";
  12.             ExecuteCommand(command, 5000);
  13.  
  14.             command = "NET USE " + directory + " /user:" + username + " " + password;
  15.             ExecuteCommand(command, 5000);
  16.  
  17.             command = " copy \"" + filePath + "\"  \"" + directory + filenameToSave + "\"";
  18.  
  19.             ExecuteCommand(command, 5000);
  20.  
  21.  
  22.             command = "NET USE " + directory + " /delete";
  23.             ExecuteCommand(command, 5000);
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement