Guest User

Untitled

a guest
Jan 21st, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. DirectoryInfo filePathDirectory = new DirectoryInfo(filePath);
  2. Process a = new Process();
  3. a.StartInfo.FileName = @"C:WindowsSystem32lpr.exe";
  4. a.StartInfo.Arguments = "-SServerName.Domain.net -Plp " + """ + filePathDirectory + """;
  5. a.StartInfo.UseShellExecute = false;
  6. a.Start();
  7. a.WaitForExit();
  8.  
  9. Dim RPname As String
  10. RPname = FileName.ToString
  11. Dim a As New Process
  12. a.StartInfo.FileName = "C:Windowssystem32lpr.exe"
  13. a.StartInfo.Arguments = "-SServerName.Domain.net -Plp " & Chr(34) & RPname & Chr(34)
  14. a.StartInfo.UseShellExecute = False
  15. a.Start()
  16. a.WaitForExit()
  17.  
  18. try
  19. {
  20. DirectoryInfo filePathDirectory = new DirectoryInfo(filePath);
  21. Process a = new Process();
  22. a.StartInfo.FileName = @"C:Windowssyswow64lpr.exe"; // ADAPTED to the new path!! worked!
  23. // use filePathDirectory.FullName!!
  24. a.StartInfo.Arguments = "-SServerName.Domain.net -Plp " + """ + filePathDirectory.FullName + """;
  25. // or change it to - found it more readable imo
  26. a.StartInfo.Arguments = string.Format(
  27. "-SServerName.Domain.net -Plp "{0}"",
  28. filePathDirectory.FullName);
  29. a.StartInfo.UseShellExecute = false;
  30. a.Start();
  31. a.WaitForExit();
  32. }
  33. catch (Exception ex)
  34. {
  35. Debug.WriteLine(ex.Message);
  36. }
Add Comment
Please, Sign In to add comment