我正在尝试在非域计算机上安装网络打印机。
我找到了提示Windows安全允许身份验证安装打印机并在共享驱动器上运行exe的唯一方法是在CMD中使用Start \\PAPERCUT\FollowMe
但是在将其转换为C#winform时,它不会安装。
我被提示验证与服务器的连接并运行exe,但是打印机没有安装并且不会抛出任何错误。
Ping pingSender = new Ping();
IPAddress address = IPAddress.Loopback;
PingReply reply = pingSender.Send("192.168.137.37");
if (reply.Status == IPStatus.Success)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = @"/C Start \\PAPERCUT\FollowMe";
startInfo.Arguments = @"/C rundll32 printui.dll PrintUIEntry /in /n \\PAPERCUT\FollowMe";
startInfo.Arguments = @"/C rundll32 printui.dll PrintUIEntry /y /n \\PAPERCUT\FollowMe";
startInfo.Arguments = @"/C Start \\PAPERCUT\PCClient\win\pc-client.exe";
process.StartInfo = startInfo;
process.Start();
greenConnectionLabel.Visible = true;
redConnectionLabel.Visible = false;
}
else
{
greenConnectionLabel.Visible = false;
redConnectionLabel.Visible = true;
}
}