问题描述
我有程序,发送文件,使用LPR'命令的打印机。
我已经安装了Windows SDK 7.1。它工作正常在32位Windows 7系统,但在64位Windows 7不工作。
I have program that sends a file to a printer using 'lpr' command.I have installed Windows SDK 7.1. It is working fine in a 32 bit Windows 7 system but not working in 64 bit Windows 7.
Process proc = new Process();
proc.StartInfo.FileName = "lpr";
proc.StartInfo.WorkingDirectory = GlobalConstants.outBaseDir;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.Arguments = " -S " + GlobalConstants.printerIP + " -P RAW " + filePath;
proc.Start();
它抛出一个execption。
It throws an execption.
推荐答案
我终于得到了回答我的问题。
I finally got the answer to my question.
步骤1:
我不得不启用LPR端口监视器。这可以通过完成控制面板/程序和功能/启用Windows功能打开或关闭。在该对话框中依次展开打印和文件服务。检查。LPR端口监视器
Step1:I had to enable "LPR Port Monitor". This can be done through "Control Panel/Programs and Features/Turn Windows features on or off". In the dialog expand "Print and Document Services." Check "LPR Port Monitor."
第二步:
当您安装Windows SDK 7.1。这将复制LPR.EXE和相关文件到C:\Windows\winsxs\amd64_microsoft - 窗口p..ting-lprportmonitor_xxxx ......。复制文件LPR.EXE,lprhelp.dll和lprmonui.dll进入C:\Windows\sysWOW64文件夹
Step2:When you install Windows SDK 7.1. It will copy lpr.exe and related files into "C:\Windows\winsxs\amd64_microsoft-windows-p..ting-lprportmonitor_xxxx...". Copy the files lpr.exe, lprhelp.dll, and lprmonui.dll into the C:\Windows\sysWOW64 folder.
这就是它!
参考:
这篇关于lpr命令无法从我的C#程序在Win 7个工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!